KABUL - Nato on Saturday pulled all its staff out of Afghan government ministries after two of its officers were shot and killed within the interior ministry, the force commander said.

“For obvious force protection reasons, I have ...taken immediate measures to recall all other Isaf personnel working in ministries in and around Kabul,” said General John Allen, commander of Nato’s International Security Assistance Force.

“I condemn today’s attack at the Afghan Ministry of Interior that killed two of our coalition officers, and my thoughts and prayers are with the families and loved ones of the brave individuals lost today,” Allen said in a statement.

“We are investigating the crime and will pursue all leads to find the person responsible for this attack. The perpetrator of this attack is a coward whose actions will not go unanswered.

“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.”

Two Americans believed to be a US colonel and major were shot dead in Afghanistan’s interior ministry while seven Afghans were reported killed in an attack on the UN compound as rage gripped the country for a fifth day over the burning of the Holy Quran at a Nato base.

A spokeswoman for Nato’s International Security Assistance Force (Isaf) confirmed two of their servicemen had been shot dead in central Kabul by an individual who turned his weapon on them. She declined to say if the killer was a member of the Afghan military or police.

Afghanistan’s Taliban movement claimed responsibility for the shootings, which it said were in retaliation for the desecration of the Qurans at Bagram airfield.

Taliban spokesman Zabihullah Mujahid said in an e-mailed statement to the media that four high-ranking Americans had been killed, though the group often exaggerate and inflate claims of casualties.

An Afghan security source said the shooting of the two Americans in the Interior Ministry could be connected to the burning of the Qurans.

Two American troops were shot dead on Thursday when an Afghan soldier turned his weapon on them at their base in Khogyani in eastern Nangarhar province as demonstrators approached.

Despite an apology from US President Barack Obama and a call for restraint from Afghan leader Hamid Karzai, thousands have taken to the streets.

In a day of violence across the country, a UN compound came under attack by thousands of demonstrators in northeastern Kunduz province, but they were driven back when police fired into the crowd, an AFP correspondent at the scene said.

Seven people were reported killed in the attack, taking the five day death toll from protests over the burning of Qurans to 31.

Violent anti-US protests have seen furious Afghans attack French, Norwegian and US bases, shouting “death to America” after the Taliban exhorted their countrymen to kill foreign troops to avenge the incident.

There were fresh protests in five different Afghan provinces Saturday over the burning of the holy book. In the assault on the UN compound in Kunduz, seven people were killed and 66 wounded, including 11 police, officials and police said.

The UN Afghanistan mission issued a statement thanking the police for their “timely response” and regretting their casualties.

“Although caused by legitimate defence, the United Nations also regrets the casualties among the demonstrators and expresses condolences to the families of those who lost their lives.

“UNAMA would like to reiterate the United Nations deep respect for Islam and understanding for the feelings of Muslims at the desecration of the Holy Qur’an,” the statement said.

“At the same time, we call upon those who would wish to express their legitimate religious sentiments to reject calls to violence...in order not to allow the enemies of peace to take advantage of the situation.”

The Taliban have urged Afghans to kill foreign troops in revenge for the Quran burning.

In Mihtarlam, in the central province of Laghman, hospital officials told AFP 15 protesters had been brought in with gunshot wounds.

Rallies elsewhere in Afghanistan were largely peaceful, however, authorities said, with protesters chanting “death to America” and “Long live Islam”.