(Reuters) - Afghan protesters angered by the burning of a Koran by an obscure U.S. pastor killed up to 20 U.N. staff, beheading two foreigners, when they over-ran a compound in a normally peaceful northern city on Friday in the worst ever attack on the U.N. in Afghanistan.
At least eight foreigners were among the dead after attackers took out security guards, burned parts of the compound and climbed up blast walls to topple a guard tower, said Lal Mohammad Ahmadzai, a police spokesman for the northern region.
Five protesters were also killed and around 20 wounded.
The governor of Balkh province said insurgents had used the march as cover to attack the compound, in a battle that raged for several hours and raises serious questions about plans to make the city a pilot for security transfer to national forces.
"The insurgents have taken advantage of the situation to attack the U.N. compound," said Governor Ata Mohammad Noor.
He told a news conference that many in the crowd of protesters had been carrying guns. Some 27 people have already been detained over the attack, he added.
Afghan police and army, who the United Nations rely on for their first line of defense, were apparently unable to control the crowd. German troops are also stationed in Balkh, and the NATO-led coalition said they had received a request for help.
"Eight foreigners were killed, and two were beheaded," said Ahmadzai.
A United Nations spokesman confirmed employees had been killed but declined to comment on numbers of dead or their nationalities. He said the attack would not push the United Nations out of Afghanistan.
"We need to secure our colleagues in Mazar-i-Sharif. It's not a question of us pulling out. The U.N. is here to stay," said spokesman Kieran Dwyer.
Staffan De Mistura, the top U.N. diplomat in Afghanistan, has flown to Mazar-i-Sharif to handle the situation personally.
The Russian chief of the mission in the city, Pavel Yershov, was injured in the attack but is now in hospital, Russian state television said, quoting an embassy spokesman.
Russia called on the Afghan government and international forces to "take all necessary measures" to protect U.N. workers in a statement issued by the foreign ministry after the attack.
Romania's foreign ministry said preliminary information suggested a Romanian citizen was among the dead, and condemned the attack. US. President Barack Obama and NATO Secretary General Anders Fogh Rasmussen also condemned the attack.
If the death toll is correct, it would make it the deadliest attack on the United Nations in Afghanistan, and one of the worst on the organization for years.
The worst previous attack was an insurgent assault on a guesthouse where U.N. staff were staying in October 2009. Five employees were killed and nine others wounded.
The two largest attacks on U.N. compounds in other countries are a 2007 bomb in Algiers that killed 17 U.N. staff, and a 2003 attack on the Baghdad hotel that was the U.N. headquarters there, which killed at least 22 people.
Mazar-i-Sharif has remained relatively peaceful as the insurgency gathers force in other parts of the north, and was recently chosen as one of the first areas for a transition of security from NATO troops to Afghan forces.
Long-standing anger over civilian casualties has been heightened by the Koran burning and the recent publication of gruesome photographs of the body of an unarmed Afghan teenager killed by U.S. soldiers.
The Christian preacher Terry Jones, who after international condemnation last year canceled a plan to burn copies of the Koran, supervised the burning of the book in front of a crowd of about 50 people at an obscure church in Florida on Sunday, according to his website.
The Koran burning was denounced by Karzai and Pakistani President Asif Ali Zardari.
Thousands of demonstrators marched through western Herat city and around 200 in Kabul to protest against the same incident, but there was no violence at either demonstration.
Intolerant religion is not the opiate of the people - it is a cancer!