Three British soldiers were shot at point blank range by a man wearing a Afghan police uniform at a checkpoint in Helmand Province, the Ministry of Defence has confirmed.
Two soldiers serving with the 1st Battalion Welsh Guards and one serving with the Royal Corps of Signals were killed. Next of kin have been informed, the Ministry of Defence said.
According to BBC Correspondant Quentin Somerville, a fourth man was injured but is in a stable condition. The gunman was captured alive and is in custody.
The incident happened at Checkpoint Kamparack Pul in Nahr-e-Saraj, where the soldiers were attending a shura, or meeting of elders. They were shot at as they were leaving the checkpoint.
Major Ian Lawrence, spokesman for Task Force Helmand, said in a Ministry of Defence statement: "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."
The deaths bring the total number of members of UK forces to have died since operations in Afghanistan began in October 2001 to 422.
The attack appears to be the latest in a string of "green on blue" attacks in which members of the Afghan security or police forces have opened fire on international allies.
Lance Corporal Lee Thomas Davies, 27, from the 1st Battalion Welsh Guards, and Corporal Brent John McCarthy, 25, of the Royal Air Force, were shot dead at a patrol base in the Lashkar Gar district of Helmand Province by members of the Afghan police force in May.
The servicemen had been providing security for a meeting with local officials when two people wearing Afghan police uniforms opened fire.
Sergeant Luke Taylor, 33, of the Royal Marines, and Lance Corporal Michael Foley, 25, of the Adjutant General's Corps, were shot dead by a rogue Afghan soldier at the entrance to the UK headquarters in Lashkar Gar in Helmand Province in March.
Five British soldiers were killed by a rogue Afghan policeman in November 2009.
The gunman opened fire on the men in a military compound in Nad e-Ali before fleeing. The Taliban later claimed responsibility.
Defence and security analyst Tim Ripley, of Jane's Defence Weekly magazine, said such attacks were "a sign of growing unease in the country".
He said: "There is the Nato withdrawal, peace arrangements that are happening, and the general fact that the war is still going on. It is a very uncertain time.
"There are three trends - some of these incidents are linked to personal arguments and, as everyone is armed to the teeth, things get out of hand.
"There is also the deliberate tactic by the Taliban to infiltrate agents into the police to launch these attacks. Then there is the uncertainty over the withdrawal that is leading to individual Afghans not knowing which side to back. Every incident is different."
Asked how such attacks could be avoided, Mr Ripley said: "You can't eliminate it 100%. The soldiers themselves can watch what's going on, get a better idea of their allies and try to pick up early warning signs, but the fact they are working with them makes them vulnerable.
"It would defeat the purpose of what they're doing if the soldiers had their own bodyguards.
"But this is now becoming a main cause of deaths of British soldiers in Afghanistan."
The shootings happened on the day Afghan National Security Forces took the security lead in southern Afghanistan.
In a ceremony at Camp Hero in Kandahar Province, the International Security Assistance Force handed over responsibility to the body, which includes the Afghan National Army, Afghan Uniformed Police, Afghan Border Police and Afghan National Civil Order Police.
The Regional Command (South) region, which includes Kandahar, Zabul, Uruzgan and Daykundi provinces, is the first area in Afghanistan where such a transition has taken place.
Major General Abdul Hamid, commander of the 205th Hero Corp, Afghan National Army, said of the move: "It wasn't that long ago that we had no security forces. We started from scratch and today we have everything."
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.
"This tragic incident again demonstrates the very real risks that our brave soldiers face every day. We will do everything possible to find out how this happened, and learn any lessons for the future."
In the light of yesterday's attack, Nato secretary-general Anders Fogh Rasmussen said: "The Taliban has clearly played out a strategy to undermine the confidence in the Afghan security forces but let me also stress that they cannot derail our strategy.
"Our strategy is to gradually hand over full responsibility for security to the Afghans and that process will continue and be completed by the end of 2014.
"This is the reason why it's an essential part of our mission in Afghanistan to try to educate Afghan security forces to build up their capability to take full responsibility and these training efforts will continue."