MAZAR-E-SHARIF, Afghanistan—Officials are painting the weekend killings at the United Nations mission in northern Afghanistan’s largest city—which sparked cascading violence across the nation—as the handiwork of a small band of insurgents that used a protest against a Quran-burning as cover for a murderous plot.WSJ’s Dion Nissenbaum reports on the Journal’s investigation into last week’s massacre in Kabul, Afghanistan that killed seven U.S. workers.

But a Wall Street Journal reconstruction of Friday’s assault, based on unreleased videos, interviews with demonstrators and the U.N.’s own recounting of events, shows a more complex picture and indicates that ordinary Afghan demonstrators played a critical role in the attack.

Stirred to action by a Quran-burning at a Florida church, thousands of people swarmed past hapless Afghan police officers, heading toward a lightly protected U.N. compound. There, members of the tight-knit staff had been paying little attention to the angry protest unfolding at the city’s central mosque.

Mazar-e-Sharif has long been considered one of the safest cities in Afghanistan. So the diverse U.N. staff—including a female Norwegian fighter pilot, a seasoned Russian diplomat and German woman who had been at the mission for only a week or so—took few precautions even when the mob converged on their compound, burned an American flag and threw stones at the blast walls.By sunset, seven U.N. workers were dead. In the ensuing days, demonstrations cascaded across Afghanistan, claiming more lives Saturday and Sunday in Kandahar, far to the south.

Based on interviews with survivors, Staffan de Mistura, head of the U.N. mission in Afghanistan, concluded that a handful of insurgents—including Afghans with accents suggesting they came from other parts of the country—spearheaded Friday’s attack on a safe room in the compound.

The rioting, which the Taliban say erupted spontaneously, adds a disturbing new threat in a country that is fighting a mostly rural insurgency. Foreign and local military forces alike are ill-prepared for riot control. “Every security-force leader’s worst nightmare is being confronted by essentially a mob,” said Gen. David Petraeus, the commander of 150,000 U.S.-led coalition forces, in an interview Sunday, “especially [a mob] that can be influenced by individuals that want to incite violence, who want to try to hijack passions, in this case, perhaps understandable passions.”The Quran-burning, held March 20 at the Dove World Outreach Center by church leader Terry Jones in Gainesville, Fla., was “hateful, extremely disrespectful and enormously intolerant,” Gen. Petraeus said.

Mr. Jones called Gen. Petraeus’ remarks “unconstitutional” and disputed that his actions complicate U.S. efforts to fight the Taliban. “I do not necessarily think that our actions make his job more difficult,” he said in an interview Sunday. “The Taliban or radical Islam will use any excuse to incite more violence. If they don’t have one, they will make up an excuse.”

Friday, thousands of people gathered in Mazar-e-Sharif’s revered Blue Mosque. Speaker after speaker denounced the Quran-burning, which for Muslims is abhorrent because Islam teaches that the physical book is holy.

“Stand up against the enemies of the Quran with your pen,” one of the men shouted from the podium, videos show. “Stand up against them with your voices. Stand up against them with weapons. It is everyone’s right to stand up against them and make a jihad.”

The protesters then surprised police by pouring into the street and marching toward the U.N. office, more than a mile away. At one point, according to videos reviewed by the Journal, the badly outnumbered police tried to use a six-foot wood beam to hold back the crowd. The protesters easily surged past.

Only about 60 police were deployed, and they appeared uncertain how to respond. Initial attempts to disperse the crowd by firing warning shots appeared only to inflame the demonstrators. The besieged U.N. staffers headed to two safe rooms intended to shield against intruders and bombs.

They phoned for help from the nearby military bases of German and Swedish forces, according to a person briefed on the situation. The U.S.-led military said the situation “escalated rapidly” and that a swift-reaction team didn’t arrive until after rioters were gone.

Once demonstrators flooded the compound, a dozen Afghan police guards—the first line of defense—dropped their weapons, said Brig. Gen. Esmatullah Alizai, the provincial police chief. “They were surrounded and confused,” he said.

Inside the compound, a small contingent of Nepalese Gurkha guards working for the U.N. faced a conundrum: They were under U.N. orders not to open fire on demonstrators. The videos show one guard feebly trying to wave an elderly demonstrator out of the compound.

Among those attacking the U.N. vehicles was a young religious student from a small village not far from the city. The student said in an interview that he and one of his friends found a propane tank that they shoved under one vehicle and set off an explosion.

Nearby, the student said, two Afghan policemen were hiding with a foreigner behind a tanker. When one of the officers shot and injured a young demonstrator, the student said he saw a chance to disarm him.

“Grab his weapon,” the student said he shouted to his friend, who wrestled a Kalashnikov assault rifle and used it to shoot the unarmed foreigner.

Inside the building, other attackers targeted one of the safe rooms. The door proved little protection against the mob. As intruders penetrated the safe room, Pavel Ershov, a Russian diplomat who speaks fluent Dari sought to protect three staff members by distracting the assailants, the U.N.’s Mr. de Mistura said.

“Are you Muslim?” the assailants asked Mr. Ershov, according to one diplomat briefed on the attack. Mr. Ershov lied and said he was, the U.N. said. The assailants tested him by asking him to recite the traditional profession of belief in Islam, which begins, “There is no God but Allah.”

When he successfully completed the test, his life was spared. Still, he was dragged into the street and beaten badly, according to a local shopkeeper who said he participated in the assault.

The attackers searched the darkened bunker with a lamp and discovered Lt. Col. Siri Skare, a 53-year-old Norwegian military attaché—the former fighter pilot—seconded to the U.N., along with Joakim Dungel, a 33-year-old Swede who had been working in the human-rights office for less than two months, and Filaret Motco, a 43-year-old Romanian who headed the mission’s political section.

As Lt. Col. Skare attempted to flee the bunker, she was intercepted by the Afghan demonstrators who had set the car on fire. She was shot with the rifle commandeered from the police officer, one of the men said. Lt. Col. Skare died of her wounds. Messrs. Dungel and Motco were killed elsewhere.

Four Afghans—men also described as “insurgents” by Gen. Alizai, the police official—were also killed. Video footage of demonstrators leaving the U.N. compound shows two men carrying Kalashnikovs and one showing off a large, blood-spattered knife.

As the attackers focused on the four U.N. workers who had been hiding in the first safe room, diplomats said, three or four others, including the German newcomer, were sheltered in a safe room in another building. They survived.

Enraged over the burning of a Koran in Florida, Muslims have murdered about 20 people in Afghanistan and five in Pakistan—none of whom ever burned a Koran or had any acquaintance with the men who did.

These killers are monstrous. They have assassinated innocent people for something that they couldn’t conceivably have had anything to do with. And yet instead of calling them monstrous and demanding that Islamic leaders stop inciting and approving of such behavior, Western government and media elites are blaming not the murderers and rioters, but the man behind the Koran-burning, the notorious Christian fundamentalist pastor Terry Jones.

Thus Guardian editor Matt Seaton explained that Jones was to blame because his Koran-burning was “done knowingly involving reckless endangerment, and quite possibly wishing for this kind of bad result.” This assumed that the Muslims who were rioting and killing over the burning of a book half a world away had no control over their reactions, and thus could not be held accountable for them: For enlightened leftists such as Seaton, it is the West’s responsibility to make sure the Islamic world behaves in a civilized manner. How paternalistic and ethnocentric of those most committed to multiculturalism.

Barack Obama reacted the same way when Jones first threatened to burn a Koran last year. He said that “this stunt that he is talking about pulling could greatly endanger our young men and women who are in uniform. Look, this is a recruitment bonanza for al-Qaeda. You could have serious violence in places like Pakistan and Afghanistan.”

Obama found the burning of the Koran, and the burning of any book, distasteful, as do I. But that was why he should have stood up for Terry Jones. Speech that is inoffensive needs no protection, and those in power can all too easily use “hate speech” codes to restrict speech they find politically inconvenient or challenging. Obama could have said: “While I disapprove of this Koran-burning, in America we believe that freedom of expression is a fundamental bulwark against tyranny and the hallmark of a truly free society, and it requires us to put up with things we don’t like without responding with violence.”

He could, in short, have used Jones’ barbecued Koran as a teaching tool to demonstrate why free societies are preferable to sharia states. But instead, Obama and the media are effectively reinforcing the principle that violent intimidation works: They knew that somewhere in the world Muslims were going to behave like rabid dogs because of the burned Koran, and instead of telling them to grow up and act like civilized people, they are demanding that free people change the way they behave to adjust to this case of rabies.

Obama could and should be telling these rioting Afghans and Pakistanis, and those who are defending them, to realize that if someone burns a Koran in Florida, it doesn’t harm them, or the Koran, or Allah, or Muhammad. He could and should tell them that to respond with irrational violence against people who are not involved with the burning (or even against the people who are involved with it) is just savagery.

People like Obama and Seaton have forgotten, if they ever knew, that one’s response to someone else’s provocative action is entirely one’s own responsibility. If you do something that offends me, I am under no obligation to kill you, or to run to the United Nations to try to get laws passed that will silence you. I am free to ignore you, or laugh at you, or to respond with charity, or any number of reactions.

Everyone in the world is so busy condemning Terry Jones that they have forgotten about freedom of expression, and why it is so important to reinforce even when we find the expression detestable—indeed, especially in such cases. And so, if we continue down this path, one thing is certain: That which is not understood or valued will not be protected, and so it will be lost.

Those who censor themselves today to keep from offending Muslims may wish in the not-too-distant future that they had stood up more robustly for the freedom of speech when it was threatened. But by then, there might be no chance for them to get that word out.

Commentary: Erick Erickson properly handles the burning of Korans. At first glance my opposition swelled against the burning of Korans. My conscience was against it. Islam is a religion. I don’t like bible burning either, or burning the Torah and other texts on God. In my mind I believe it would be blasphemous. It would touch upon a deadly sin. Yet, how strange politics has become to even consider this spiteful act. Extremism is challenging man’s intelligence, and we need alertness to today’s excuse for more violence.