Two American troops were killed and six others wounded by an Afghan soldier armed with a machine gun, the US military confirmed Sunday.
The deaths come at a sensitive time in the 18-year-old war, with President Donald Trump eager to bring troops home and end the longest conflict in US history.
The incident occurred late Saturday at a base in Sherzad district, in Nangarhar province, eastern Afghanistan.
"Current reports indicate an individual in an Afghan uniform opened fire on the combined US and Afghan force with a machine gun," US Forces-Afghanistan spokesman Sonny Leggett said in a statement on Sunday.
Provincial governor Shah Mahmood Meyakhil said in an audio message to reporters that three Afghan commandos were wounded.
He said it was not immediately clear if the incident was a deliberate act by an "infiltrator" or an accident.
"It was not a clash between the forces. We are investigating," Meyakhil said.
Leggett also stressed the cause or motive behind the attack were not immediately known.
In a tweet, the US Army's 7th Special Forces Group (Airborne) said "several" of its soldiers had been killed or injured during combat operations in Afghanistan.
According to Sherzad resident Najeebullah -- who goes by one name -- gunfire could be heard coming from an Afghan security forces base nearby late Saturday followed by immediate air evacuations.
"We heard the sounds of gunfire and immediately helicopters landed inside the base and evacuated the casualties," added Najeebullah.
No group immediately claimed responsibility for the incident.
Taliban spokesman Zabihullah Mujahid later declined to comment on the incident, saying in a message sent to AFP only that the insurgents were "investigating" the attack.
Last year was the deadliest for US forces in Afghanistan since combat operations officially finished at the end of 2014, highlighting the challenging security situation that persists.
Depending on how one qualifies combat deaths, about 20 American troops were killed in 2019. Since the US-led invasion in October 2001, about 2,400 US troops have been killed in combat in Afghanistan.
In December, Taliban infiltrators in the Afghan military killed nine Afghan soldiers in central Afghanistan.
In July, an Afghan soldier killed two US troops as they were visiting an Afghan army base in Kandahar. Such insider attacks are sometimes called "green-on-blue" incidents.
That came two weeks after another Afghan soldier shot and killed an influential Afghan army colonel while he was conducting a security assessment in Ghazni province.
US special envoy Zalmay Khalilzad has been negotiating with the Taliban for about 18 months for a deal that would see the Pentagon pull thousands of troops from Afghanistan.
In return, the Taliban would guarantee the country is not used as a jihadist safe haven.
Many are sceptical of the proposed deal and Trump himself declared talks "dead" in September amid continued Taliban violence.
Negotiations have since resumed in Qatar.