Two senior Nato officers have been shot dead in Kabul's Interior Ministry as mass violent protests against the accidental burning of the Koran by US troops continued in Afghanistan.
Britain said it is withdrawing all civilian advisers from institutions in the Afghan capital Kabul following the shooting.
A Foreign Office spokesman said: "As a temporary measure the British Embassy has withdrawn civilian mentors and advisors from institutions within Kabul. We will keep the situation under review."
The announcement came as General John Allen, the commander of Nato and US forces in Afghanistan, said he was recalling Nato personnel from the ministries in the city "for obvious force protection reasons".
Gen Allen said Nato was investigating the latest shooting and would pursue all leads to find the person responsible.
"The perpetrator of this attack is a coward whose actions will not go unanswered," Allen said.
Nato has advisers embedded in many Afghan ministries, both as trainers and to help manage the transition to Afghan control when the majority of the international forces leave by the end of 2014.
A Nato statement said: "Initial reports indicate an individual turned his weapon against International Security Assistance Force (ISAF) service members in Kabul City today, killing two service members."
The Taliban claimed responsibility for the shootings, Sky News said.
In a statement, Taliban spokesman Zabiullah Mujahid said the gunman was an insurgent named Abdul Rahman. He said that an accomplice in the ministry helped him to get inside the compound.
At least 28 people have been killed and hundreds wounded since Tuesday, when it first emerged that Korans and other religious materials had been thrown into a fire pit used to burn rubbish at the Bagram air base.
Among those dead were two US soldiers who were killed Thursday by one of their Afghan counterparts while a riot raged outside their base in the eastern province of Nangarhar.
The demonstrations began after US military personnel were found to have put two copies of the Koran into rubbish due to be burned at an incinerator at the Bagram air base north of Kabul.
The books were discovered by Afghan staff at the base, and the protests began soon after.
A televised apology by Nato's commander in Afghanistan General John Allen failed to quell the violence.
Fresh appeals for calm on Friday by Allen and President Barack Obama in a letter to Afghanistan's president Hamid Karzai also did not stop the fury escalating around the country.
Meanwhile Republican presidential candidate Newt Gingrich claimed that the president's apology was "astonishing".
On Thursday the Taliban called on Afghan people to attack the "invading forces" for "insulting" the Koran.
Up to 12 people died on Friday in the worst day since the unrest began, and on Saturday a UN base in the city of Kunduz was set alight and seven more people were reported dead around the country.
The BBC said that around 500 demonstrators charged police near to the UN compound, and according to authorities "refused our warnings" after shots were fired into the air.
Witnesses told the BBC that shops were set alight and a government building was attacked, along with the governor's house in Laghman which had to be secured by troops.
In 2011 more than 20 people were killed in angry protests after the Koran was burned by a pastor in Florida.