The Ministry of Defence has confirmed three British Nato soldiers have been killed while mentoring police in Afghanistan.
The gunman was reported to be dressed in an Afghan police uniform when he shot at the soldiers at Check Point Kamparack Pul in Nahr-e-Saraj, Helmand Province, Afghanistan.
The gunman was later injured and detained, according to Nato. He is believed to be a member of the elite Afghan National Civil Order Police force (ANCOP).
The family members of those were killed in the attack have been informed.
The deaths bring the total number of British fatalities in Afghanistan to 422.
The attack comes nearly two weeks after three men in Afghan police uniforms killed a soldier with the US-led force, also in the south.
Relationships of foreign forces in Afghanistan have been strained following the news one US soldier shot and killed 16 Afghan civilians in March and another US troop burned copies of the Quran at an base in Afghanistan in February.
The MoD said: "The soldiers were serving in an Afghan Police Advisory Team and had been to the check point to conduct a shura.
"On leaving, they were engaged by small arms fire by a man wearing an Afghan Police uniform.
"During this exchange of fire the three soldiers were wounded and despite receiving first aid at the scene, they died of their injuries"
The spokesman for Task Force Helmand, Major Ian Lawrence, said: "It is with deep regret that I must inform you that three soldiers, two serving with 1st Battalion Welsh Guards and one serving with the Royal Corps of Signals, have been killed in an incident at Check Point Kamparack Pul in the Nahr-e-Saraj district of Helmand Province.
"Their loss will be felt deeply across Task Force Helmand. However, this will be nothing compared to the grief experienced by the soldiers' families. Our thoughts and prayers are with them at this extremely difficult time."
Prime Minister David Cameron said: "I am deeply saddened by the appalling news that three British soldiers have been killed in Afghanistan. My heart goes out to their families.
"These brave soldiers were demonstrating great courage to help prevent Afghanistan once again become a haven for international terrorists and therefore to help keep us safe here in the UK.
"The suspected perpetrator is in custody and we will do everything in our power, with the Afghan National Security Forces, to ensure that justice is done."
NATO has around 130,000 soldiers fighting alongside some 350,000 Afghan security personnel against the Taliban-led insurgency, but they are due to pull out of the country in 2014.