A Royal Marine and a soldier have been shot dead by a rogue Afghan National Army gunman.
Afghan military leaders said it was unclear whether the gunman was acting alone or had been "influenced by the enemy".
In a similar incident a third serviceman - not British - was shot dead by Afghan security forces.
Monday's three deaths appear to be the latest in a string of "green on blue" attacks in which members of the Afghan security forces have opened fire on international allies.
The Marine and the Adjutant General's Corps soldier were serving as part of Task Force Helmand when the ANA soldier opened fire at the gate of the British headquarters in Lashkar Gar city, southern Afghanistan.
The families of the servicemen have been told.
ANA Brigadier General Sherin Shah said the "incident which involved armed conflict by one of the ANA members of the Fourth Kandak of 3-215 Brigade was a tragic event". He added: "The incident is still under investigation and it is unclear if the action was planned or influenced by the enemy or if he acted alone. Either way it is with the deepest regret that two Isaf (International Security Assistance Force) soldiers who came to our country to provide security are now dead."
According to the Associated Press the attacker had been in close contact with insurgents and had informed the Taliban of his plan. Ghulam Farooq Parwani, deputy commander of the Afghan National Army in Helmand, said the gunman was from the eastern Nangarhar province and had been in the army for four years.
The soldier, who arrived at the gate of the base in an army vehicle, approached the British troops claiming that he had been assigned to provide security for a delegation of government officials from Kabul who were visiting the base. Mr Parwani added: "He got close to the foreign troops - three or four metres - and he opened fire. Then the foreign troops killed him."
The third serviceman to be killed was shot by Afghan police in eastern Afghanistan.