An Afghan security official stands guard outside the provincial governor’s compound where an Afghan wearing a military uniform opened fire on U.S. troops in Jalalabad, Afghanistan. (Ghulamullah Habibi/ European Pressphoto Agency )

One U.S. soldier was killed and at least two were wounded by an Afghan in military uniform when a firefight erupted Wednesday after a U.S. Embassy delegation’s visit in eastern Afghanistan, according to U.S. and Afghan officials.

American soldiers subsequently killed the assailant in a shootout. Officials said one Afghan soldier was killed and two were wounded in the assault.

The attack highlighted the dangers faced by the approximately 10,000 U.S. troops left in Afghanistan after America’s longest war was officially declared over at the end of last year. Those troops, earlier expected to number half as many by the end of this year, will remain in place after President Obama agreed last month to delay their planned exit amid concerns that a resurgent Taliban could escalate its offensives this year.

The mission of the remaining troops is primarily to train and advise Afghan security forces. But Wednesday’s assault was a reminder that even mundane tasks such as protecting U.S. diplomats in routine meetings could turn deadly. In the past few weeks, the Taliban insurgency has ramped up attacks after a nearly three-month winter lull, staging several suicide bombings in the capital and in other areas of the country.

U.S. Army Maj. Chris Belcher, a spokesman for NATO’s American-led Resolute Support mission in Afghanistan, said one coalition service member died in the incident. Belcher did not reveal the nationality, in accordance with military guidelines. A senior Afghan military official in Jalalabad, where the attack occurred, said one U.S. soldier was killed and two were wounded. The official spoke on the condition of anonymity because he was not authorized to brief reporters.

It was the second death of a coalition service member this year.

Marine Maj. Brad Avots, a Pentagon spokesman, said in Washington that he could confirm that a handful of Americans were wounded, but he did not provide details.

Whether the assailant was an Afghan soldier or an insurgent disguised as one was not clear. Afghan police officials in Jalalabad said the attacker was a soldier, although Afghan military officials said that they were not certain and that an investigation was underway.

If it was an “insider attack” perpetrated by an Afghan soldier, it would mark the second instance this year of such an assault. In late January, an Afghan soldier killed three American contractors at a military base attached to Kabul’s international airport, triggering a shootout in which the attacker was killed. A fourth American contractor was wounded.

Insider attacks have long plagued the relationship between Afghan forces and their international allies, breaking down trust and reducing interaction. The assaults by rogue Afghan soldiers or police personnel increased in the last years of the NATO combat mission, which formally ended in December. They reached record levels in 2012, when there were 37 such attacks, according to the Pentagon. Fifty-one people, including 32 U.S. troops, were killed.

Wednesday’s shooting unfolded shortly after a senior U.S. official held a meeting in Jalalabad with the governor of Nangahar province, said U.S. Embassy spokeswoman Monica Cummings. Also present at what Afghan officials described as a meeting about security and reconstruction needs were senior NATO officials, American soldiers protecting the entourage and governors from two neighboring provinces.

“We are aware that there was an exchange of gunfire involving Resolute Support service members near the provincial governor’s compound in Jalalabad,” Cummings said in a statement. “All chief of mission personnel of the visiting party are accounted for.”

Afghan officials said Ambassador Michael McKinley was not present at the meeting. State Department spokeswoman Marie Harf said in Washington that Donald Y. Yamamoto, who also holds ambassadorial rank, was at the meeting.

Yamamoto, a former U.S. ambassador to Ethi­o­pia and principal deputy assistant secretary in the State Department’s Bureau of African Affairs, is the senior civilian representative in Afghanistan for Regional Command North, the State Department said. He works out of Bagram air base.

After the attack, Yamamoto and his team were flown out of Jalalabad by helicopter, U.S. officials.

Hazrat Hussain Mashreqiwal, chief police spokesman for Nangahar province, of which Jalalabad is the capital, said the attack occurred after the delegation of U.S. and Afghan officials left the governor’s compound.

“One Afghan National Army soldier, who was on the top of a military truck with a machine gun, was guarding the governor compound along with the American soldiers,” Mashreqiwal said. “He opened fired on the American soldiers. The attacker was then killed in return fire.”

He added that one Afghan soldier was arrested and is being investigated for possible involvement in the attack.

William Branigin and Dan Lamothe in Washington contributed to this report.

Read more:

Top U.S. general in Afghanistan leaves door open to altering drawdown plan

Former Obama ambassadors against a full Afghan troop withdrawal in 2016

Today's coverage from Post correspondents around the world