Nato has withdrawn all its personnel from Afghan ministries after two senior US officers were shot dead in the interior ministry building in Kabul.
Nato said an "individual" had turned his gun on the officers, believed to be a colonel and major, and had not yet been identified or caught.
Nato commander Gen John Allen condemned the attack as "cowardly".
The shootings come amid five days of deadly protests over the burning of copies of the Koran by US soldiers.
The interior ministry was put in lock-down after the shootings, officials said.
The BBC's Orla Guerin in Kabul says eight shots were reported inside the building, which should be one of the safest in the capital, and that any Afghan who carried out the attack would have had the highest clearance.
Local media reports said the gunman was an Afghan policeman but this has not been confirmed.
The reports suggest the incident followed a "verbal clash".
Gen Allen said he condemned the attack, adding: "We will pursue all leads to find the person responsible. The perpetrator of this attack is a coward whose actions will not go unanswered."
Continue reading the main story
Bilal Sarwary BBC News, Kabul
If the gunman is Afghan, serious questions will be raised about how an attacker managed to get inside one of the most secure buildings in the country, especially its command and control centre.
Afghan security has signally failed to find a strategy to prevent the killing of Nato forces at the hands of Taliban infiltrators and rogue soldiers. One senior Afghan general said it was "a nightmare that refuses to go away" and one presidential aide called it a major obstacle that has created mistrust, anger and frustration between Nato operatives and their Afghan counterparts.
The pulling out of Nato advisers will for now paralyse important areas, such as technical support, intelligence sharing and many ongoing security operations. It disconnects the coordination of the Afghan government with Isaf.
The killings could also not have come at a more tense time - on a fifth day of demonstrations, with attacks on police and army positions across several provinces.
He said: "For obvious force protection reasons, I have also taken immediate measures to recall all other Isaf personnel working in ministries in and around Kabul."
But Gen Allen added: "We are committed to our partnership with the government of Afghanistan to reach our common goal of a peaceful, stable and secure Afghanistan in the near future."
The UK Foreign Office confirmed it had "withdrawn civilian mentors and advisers from institutions in the city as a temporary measure".
The Pentagon said the US condemned the killings "in the strongest possible terms".
Press secretary George Little said Afghan Defence Minister Gen Abdul Rahim Wardak had called US Defence Secretary Leon Panetta to apologise for the shootings.
Mr Little said Mr Panetta was calling on Afghanistan to take decisive action to protect Nato forces.
Isaf spokesman Brig Gen Carsten Jacobson said that Nato could not yet reveal the identity of those killed.
He also said: "We cannot confirm where the killer came from, what his nationality was, whether he was in uniform or not, all these questions are not known."
Early reports suggest the two officers were shot in the ministry's command and control centre.
The BBC's Bilal Sarwary in Kabul says this is where representatives of 34 provinces meet to plan security.
He quotes sources as saying that Interior Minister Bismullah Khan was having a meeting with senior Western officials elsewhere in the building when the shooting took place.
The Taliban said in a website statement that it carried out the attack in response to the Koran burnings.
But Gen Jacobson would not be drawn on any link to the protests.
He said: "We have seen an emotional week, we have seen a busy week - but it would be too early to say this incident was linked."
He added: "It is very regretful to see the loss of life again on this day, and that includes the loss of life that we have seen around demonstrations."
Angry protests over the burning of the Korans continued on Saturday, with a UN compound in the city of Kunduz set alight.
BBC's Orla Guerin: "People demand tough action against US troops"
Four people were killed and dozens injured in clashes in the city, according to local doctors. Three more people were killed in the southern province of Logar.
The governor's house in Laghman province also came under attack on Saturday and there were demonstrations in Paktia, Nangarhar and Sari Pul provinces.
Nearly 30 people have died since the protests began on Tuesday.
US personnel apparently inadvertently put the books into a rubbish incinerator at Bagram air base, near Kabul.
US President Barack Obama has apologised for the Koran-burning incident.
In a letter to his Afghan counterpart Hamid Karzai, Mr Obama said the books had been "unintentionally mishandled".
Muslims consider the Koran the literal word of God and treat each book with deep reverence.
Very smart. Sometimes I'm thinking that America is doing the Taliban's very best recruitment campaign.