Afghans carrying a man, who got wounded following an attack on UN's office during a demonstration to condemn the burning of a copy of the Muslim holy book by a Florida pastor, in Mazar-i- Sharif north of Kabul, Afghanistan. (Mustafa Najafizada/AP)

An angry mob killed at least seven foreigners in northern Afghanistan and set fire to a United Nations compound, as a protest over a Koran burning in Florida swelled into chaotic violence Friday, according to Afghan and Western officials.

The attack in Mazar-e Sharif, normally a bastion of calm, swelled out of a midday gathering called to denounce the actions of Terry Jones, a preacher in Gainesville, Fla., who burned the Islamic holy book on a grill last month. The Taliban had issued a statement blaming “American Rules” for Jones’s “crime.’’

At least four protesters also were reported killed during the attack on the U.N. office.

President Obama condemned Friday’s killings “in the strongest possible terms” and urged calm and dialogue. U.N. Secretary General Ban Ki-moon called the attack “an outrageous and cowardly act.’’ Neither statement mentioned the burning of the Koran.

In September, Jones had stepped back from plans to burn the Koran, which he has deemed responsible for terrorist activities, after public criticism from U.S. faith leaders and warnings from the Obama administration. In contrast, the Koran burning that Jones carried out March 20 had attracted little attention, and the Obama administration appeared to have been taken by surprise by the issue’s sudden reemergence.

The episode could further inflame tensions in a turbulent Islamic world, at a time of mass protests in the Middle East and a period in which the Obama administration has tried to portray Afghanistan as moving steadily toward stability. Leaflets distributed in advance of Friday’s protests had called on Afghanistan to sever ties with the United States if Jones was not punished for his actions.

U.S. officials had been warned that the protest, scheduled to be held at the famed Blue Mosque in downtown Mazar-e Sharif, could turn violent, and they were told by security officials to avoid the area. At the midday prayers, hundreds gathered to hear the sermon and speeches denouncing the Koran burning, then surged south toward the U.N. headquarters as the crowd grew larger and more violent. 

In the tumult, with police firing their weapons, some in the crowd broke into the U.N. office, past high walls and foreign and Afghan security guards, then torched guard towers and attacked and killed members of the U.N. staff, officials said. Among those killed were four Nepalese guards and at least three U.N. staff members, including a Swede, a Romanian and a Norwegian, according to a Western official briefed on the preliminary investigation.

U.N. buildings have been attacked in the past by insurgents, both in Kabul and in the western city of Herat, but the violence Friday marked a particularly grim chapter in the United Nations’ long history in Afghanistan. The U.N. envoy to Afghanistan, Staffan de Mistura, traveled to Mazar-e Sharif on Friday along with the mission’s security chief to deal with the aftermath of the attack. Afghan officials said five Afghan protesters were also killed and 20 were wounded.

There were no reports of deaths or injuries among the U.S. staff and their contractors in the city, which is slated to be the site of a future U.S. consulate.

Witnesses said the crowd had included some armed men who threw rocks, burned U.S. flags and chanted anti-U.S. slogans, according to officials and participants. Security forces engaged in a sustained gunfight with militants as they sought to wrest control of the compound. Gunfire rang out for more than an hour.

It was not immediately clear whether the crowd itself had turned violent or whether Taliban insurgents might have infiltrated the gathering to carry out the attack, as some Afghan officials suggested. The Taliban posted a short statement on its Web site about the incident, claiming that protesters had killed “10 U.S.-NATO invaders” after soldiers shot at demonstrators, but the group did not assert responsibility for the attack.

‘Great insult’

In Gainesville, Jones demanded action against the perpetrators by the U.S. government and the United Nations, calling the attack a “tragic and criminal action.”

“The time has come to hold Islam accountable,” he said in a statement issued by his organization, Stand Up America Now.

In a video showing the Koran burning on March 20 at his Dove World Outreach Center church, Jones can be heard commenting that “it actually burns very good.’’

Although U.S. law enforcement has regularly monitored Jones’s activities, senior U.S. military leaders and administration officials who dissuaded Jones from his earlier plan to burn the Koran appeared to have been unaware of the latest episode either before or immediately after it took place. Jones had advertised his event as a “trial” on Koranic guilt in causing terrorism. On March 18, he asked his followers online to recommend a proper “punishment.” His announcement of the verdict, the form of punishment and the act itself all took place within moments of one another.

There was virtually no coverage of the Koran burning in the United States, and it provoked little immediate reaction in the Islamic world. Afghan President Hamid Karzai and Pakistani President Asif Ali Zardari both issued statements denouncing the burning last week, with Karzai calling it “disrespectful and abhorrent.” On March 25, U.S. embassies in both countries condemned it as “disrespectful, intolerant, divisive and unrepresentative of American values.”

On Monday, the Afghan Nationwide Scholars’ Council issued a condemnation, calling for the perpetrators to be punished for a “great insult to Holy Islam” that it said was designed to provoke violence. At the United Nations, the Organization of the Islamic Conference held an emergency meeting to condemn the burning and highlight the group’s “grave concern” that the act had insulted the world’s 1.5 billion Muslims.

In condemning the burning, the Taliban blamed U.S. officials and media outlets.

“The American media outlets like their rulers stayed completely silent as regards this inhumane and wicked action,” the Taliban statement said, saying that the act should not have been permitted even under freedom-of-expression laws. “Hundreds of times, we have seen abhorrent instances of blasphemy at the hands of the American soldiers in Guantanamo, Abu Ghraib and Bagram prisons, desecrating the Holy Quran and other Islamic tenets.”

The Taliban statement did not directly incite people to violence but prodded devout Muslims to action. “Put pressure on rulers of your countries to come out of the cocoon of hesitation and raise the issue of the Holy Quran burning at world level,” the statement urged.

Pentagon spokesman Geoff Morrell said Friday’s violence “proves why we were right to be concerned” when Jones made his original threats last summer. “Irresponsible words and actions do have consequences,” Morrell said. “This time, they were tragic, deadly consequences.”

The violence demonstrated the “ripple effect of how action that might go unnoticed here can still cause a wave of destruction downrange,” he said.

Staff writers Karen DeYoung in Washington and Colum Lynch in New York, staff researcher Julie Tate in Washington and special correspondent Javed Hamdard in Kabul contributed to this report.