Immersed in the warm glow of dusk, worshipers streamed into the Grand Mosque of Mecca in Saudi Arabia. Some carried suitcases and mattresses for the night they would spend in the thousand-room labyrinth beneath Islam’s holiest shrine. Coffins also glided in for the imam’s traditional blessings of worshipers’ dead relatives before burial. Some of the wooden caskets, though, contained deadly contraband — Kalashnikov assault rifles and an assortment of pistols.

As 50,000 of the faithful knelt in concentric circles in the vast courtyard at dawn the next morning — New Year’s Day of the Islamic year 1400, or Nov. 20, 1979, on Western calendars — hundreds of Islamist radicals from Saudi Arabia, Egypt and other countries seized the mosque and held worshipers hostage. They overpowered the guards, locked the gates and turned minarets into snipers’ nests, proclaiming the arrival of the savior, the Mahdi, who would cleanse the Muslim world of infidel influences.

[The Grand Mosque attack was] one of the major events in radical Islamic terrorism.

Abbas Milani, director, Iranian studies program, Stanford University

The siege of Mecca was the first act of modern international jihad, an opening salvo in the war between a radical version of Islam and the West. It was also a challenge to the House of Saud, which had ruled the Arabian Peninsula since 1744, a radicalizing event for a young Osama bin Laden and a preview of what became al-Qaida.

As soon as word of the assault filtered back to the capital, Riyadh, the country’s shaken royal rulers clamped down with a near-total news blackout, cutting off all Saudi phone lines to the outside world and closing the borders. When Mecca’s police finally scrambled to the scene a few hours later, they were repelled by gunfire and suffered high casualties. The Ministry of the Interior then did the previously inconceivable: It sent troops — the national guard, the regular army and special forces — into Mecca.

But first the ministry had to cut a deal. Muslim tradition holds that the mosque is so sacred it’s forbidden to bear arms there. Before reluctant Saudi soldiers agreed to follow orders, the Ministry of the Interior had to secure an authorization, a fatwa, from Muslim clerics vetting the counterattack as permissible under the circumstances. according to Yaroslav Trofimov, former Wall Street Journal reporter and author of The Siege of Mecca.

Once on-site, the troops encountered a stubborn foe under the leadership of cleric Juhayman al-Otaybi. A former member of the Saudi national guard and a fervent Wahhabi, al-Otaybi followed a fundamentalist interpretation of Islam and believed that the House of Saud, or Al Saud, had become too Westernized and that Muslims must return to Prophet Muhammad’s ascetic lifestyle. Yet unlike Wahhabi clerics who had conceded worldly power to the royal family, al-Otaybi had an overt political goal: Overthrow the House of Saud.

The gunmen held the shrine for two weeks. Saudi security forces had to rely on architectural plans provided by a construction company run by Osama bin Laden’s father — the firm was renovating the Grand Mosque — for the layout of the underground maze of rooms and corridors. American and French warplanes were called in to provide aerial surveillance on the attackers’ above-ground positions.

In the end the Saudi military had to deploy tanks and artillery to subdue the rebels, heavily damaging the mosque and its grounds. To flush out jihadists from the subterranean labyrinth, French special forces piped poison gas into the basement. The Saudi government named the death toll at around 255, but outside sources estimate as many as 1,000 fatalities. A few months later, al-Otaybi was beheaded.

In the aftermath, the House of Saud reached another accommodation with Wahhabi leaders. In exchange for a commitment to stop undermining the royal family, the Saudi regime agreed to give the moral police greater power, roll back modernizing reforms, such as allowing women to appear on television, and underwrite the export of Wahhabism to other countries. “[The year] 1979 was the turning point in the rise of Saudi policy of exporting its doctrine of Islam all over the Muslim world,” says Jocelyne Cesari, professor of religion and politics at the University of Birmingham and Georgetown University. Following the covenant to export Wahhabism, Saudi Arabia beat out Iranian and Pakistani religious movements to win the global soft power war in the contemporary world, says Cesari. “No debate on Muslim orthodoxy can escape Wahhabism.”

Saudi Arabia has spent billions since the siege to fund madrassas and other religious institutions around the world, spreading a fundamentalist interpretation of Islam that provides theological justification for groups like al-Qaida, according to Cesari. Prof. Abbas Milani, director of the Iranian studies program at Stanford University, calls the siege “one of the major events in radical Islamic terrorism.”

The bloodbath at the Grand Mosque scandalized and radicalized Osama bin Laden, who thought the Saudi military should have simply starved out the rebels, according to author Trofimov, even though that tactic might have spelled doom for 50,000 hostages. For the wealthy young college graduate, the military desecration of the mosque marked the end of fealty to the Saudi kingdom, which had enriched the family business over the decades.

The siege also marked the initial collaboration of what became two key components of al-Qaida — Wahhabi fundamentalists from Saudi Arabia and jihadists who emerged from the Muslim Brotherhood in Egypt. Eventually, the Saudi Osama bin Laden partnered with the Egyptian Ayman al-Zawahir to head up al-Qaida, with other veteran Egyptian jihadists filling senior leadership positions. “Bin Laden was both literally and theoretically an ominous marriage of Wahhabism and the Muslim Brotherhood,” says Milani. “Clearly, he was watching” in 1979 and learned how much could be accomplished “if you have a dedicated group.”