It's four decades since a charismatic preacher and his followers staged an armed takeover of the Grand Mosque of Mecca and the holiest place in Islam became a killing field. The resulting siege, writes the BBC's Eli Melki, shook the Muslim world to its foundations and changed the course of Saudi history.
In the early hours of 20 November 1979, some 50,000 faithful from all over the world gathered for dawn prayers in the huge courtyard surrounding the sacred Kaaba in Mecca, Islam's holiest place. Among them mingled 200 men led by a charismatic 40-year-old preacher called Juhayman al-Utaybi.
As, the imam finished leading prayers, Juhayman and his followers pushed him aside and seized the microphone.
They had placed closed coffins in the centre of the yard, a traditional act of seeking blessings for the recently deceased. But when the coffins were opened, they revealed handguns and rifles, which were quickly distributed among the men.
One of them began to read a prepared speech: "Fellow Muslims, we announce today the coming of the Mahdi… who shall reign with justice and fairness on Earth after it has been filled with injustice and oppression."
For the pilgrims in the courtyard, this was an extraordinary announcement. In the hadiths - reports of what the Prophet Muhammad said or approved - the coming of the Mahdi, or divinely guided one, is foretold. He is described as a man endowed with extraordinary powers by God, and some Muslims believe he will usher in an era of justice and true belief.
The preacher, Khaled al-Yami, a follower of Juhayman, claimed that "countless visions have testified to the coming of the Mahdi". Hundreds of Muslims had seen him in their dreams, Yami said, and now he was in their midst. The Mahdi's name was Mohammed bin Abdullah al-Qahtani.
In an audio recording of the speech, Juhayman can be heard interrupting the speaker from time to time to direct his men to close the shrine's gates and take up sniper positions in its tall minarets, which then dominated the city of Mecca.
''Attention brothers! Ahmad al-Lehebi, go up on the roof. If you see someone resisting at the gates, shoot them!''
According to an anonymous witness, Juhayman was the first to pay homage to the Mahdi, and immediately others started following his example. Cries of "God is great!" rang out.
But there was confusion too. Abdel Moneim Sultan, an Egyptian religious student who had got to know some of Juhayman's followers, recalls that the Grand Mosque was full of foreign visitors who spoke little Arabic and did not know what was happening.
The sight of armed gunmen in a space in which the Koran strictly forbids any violence, and a few gunshots, also stunned many worshippers, who scrambled to reach any exits still left open.
''People were surprised at the sight of gunmen... This is something they were not used to. There is no doubt this horrified them. This was something outrageous,'' says Abdel Moneim Sultan.
But in just an hour the audacious takeover was complete. The armed group was now in full control of the Grand Mosque, mounting a direct challenge to the authority of the Saudi royal family.
The men who took over the Grand Mosque belonged to an association called al-Jamaa al-Salafiya al-Muhtasiba (JSM) which condemned what it perceived as the degeneration of social and religious values in Saudi Arabia.
Flush with oil money, the country was gradually transforming into a consumerist society. Cars and electrical goods were becoming commonplace, the country was urbanising, and in some regions men and women began to mix in public.
But the JSM's members continued to live an austere life, proselytising, studying the Koran and the hadiths, and adhering to the tenets of Islam as defined by the Saudi religious establishment.
Juhayman, one of the JSM's founders - who hailed from Sajir, a Bedouin settlement in the centre of the country - confessed to his followers that his past was far from perfect. During a long evening around a fireplace in the desert, or a gathering in the house of one of his supporters, he would tell his personal story of fall and redemption to a captivated audience.
Usama al-Qusi, a religious student who frequented the group's meetings, heard Juhayman say that he had been involved in "illegal trading, including drug smuggling".
However, he had repented, found solace in religion and became a zealous and devoted leader - and many members of the JSM, especially the younger ones, fell under his spell.
Most of those who knew him, such as religious student Mutwali Saleh, attest of his force of personality as well as his devotion: "Nobody saw this man and didn't like him. He was strange. He had what is called charisma. He was true to his mission, and he gave his whole life to Allah, day and night."
However, for a religious leader he was poorly educated.
"Juhayman was keen to go to the isolated and the rural areas where Bedouins live," Nasser al-Hozeimi, a close follower, recalls. "Because his classical Arabic [the language mastered by all scholars of Islam] was weak and he had a strong Bedouin accent, he avoided addressing any educated audience to avoid being exposed."
More from BBC Arabic
On the other hand, Juhayman had served as a soldier in the National Guard, and his rudimentary military training proved important when it came to organising the takeover.
Eventually, the JSM began to clash with some Saudi clerics and a crackdown by the authorities ensued.
Juhayman fled to the desert, where he wrote a series of pamphlets criticising the Saudi royal family for what he considered it to be its decadence, and accusing clerics of colluding with it for earthly gains. He became convinced that Saudi Arabia had been corrupted and that only a heavenly intervention could bring salvation.
It was at this point that he identified the Mahdi as Mohammad Bin Abdullah al-Qahtani, a soft-spoken young preacher known for his good manners, devotion and poetry.
The hadiths talk of a Mahdi with a first name and father's name similar to the prophet's, and features outlined by a large forehead and a pronounced thin, aquiline nose. Juhayman saw all of this in al-Qahtani, but the supposed saviour himself was taken aback by the idea. Overwhelmed, he retreated into prayer.
Eventually, however, he emerged from his isolation convinced that Juhayman was right. He took on the role of Mahdi, and the alliance with Juhayman was sealed all the more tightly when Qahtani's older sister became Juhayman's second wife.
Conveniently, a few months before the siege, strange rumours spread that hundreds of Meccans and pilgrims had seen al-Qahtani in their dreams, standing tall in the Grand Mosque and holding the banner of Islam.
Juhayman's followers were convinced. Mutwali Saleh, a member of the JSM, recalls: "I remember the last meeting when a brother asked me, 'Brother Mutwali, what do you think about the Mahdi?' I said to him, 'Excuse me please, don't talk about this subject.' Then someone said to me, 'You are a silent devil. Brother, the Mahdi is real and he is Muhammad bin Abdullah al-Qahtani.'"
In the remote areas where he had sought refuge, Juhayman and his followers began to prepare for the violent conflict to come.
The Saudi leadership reacted sluggishly to the seizure of the Grand Mosque.
Crown Prince Fahd bin Abdulaziz al-Saud was in Tunisia at the Arab League summit and Prince Abdullah, head of the National Guard - an elite security force tasked with protecting royal leaders - was in Morocco. It was left to the ailing King Khaled and Defence Minister Prince Sultan to co-ordinate a response.
The Saudi police at first failed to understand the scale of the problem and sent a couple of patrol cars to investigate, but as they drove up to the Grand Mosque they came under a hail of bullets.
Once the gravity of the situation became clear, units of the National Guard launched a hasty effort to retake control of the shrine.
Mark Hambley, a political officer at the US embassy in Jeddah and one of the few Westerners who were aware of the situation, says this assault was brave but naïve. "They were immediately shot down," he says. "The sharp-shooters had very good weapons, very good calibre Belgian rifles."
It became clear that the insurgents had planned their attack in detail and would not be easy to dislodge. A security cordon was established around the Grand Mosque, and special forces, paratroopers and armoured units were called in.
Religious student Abdel Moneim Sultan, who was trapped inside, says clashes intensified from after noon on the second day. ''I saw artillery fire directed towards the minarets, and I saw helicopters hovering constantly in the air, and I also saw military airplanes," he remembers.
The Grand Mosque is a vast building consisting mainly of galleries and corridors, hundreds of meters long, surrounding the Kaaba's courtyard, and built on two floors. During the next two days, the Saudi units launched frontal assaults in an effort to gain entrance. But the rebels repelled wave after wave of attacks, despite being heavily outgunned and outnumbered.
Abdel Moneim Sultan recalls that Juhayman appeared supremely confident and relaxed when they met near the Kaaba that day. "He slept for half an hour or 45 minutes resting his head on my leg, while his wife stood by. She never left his side," he says.
The rebels lit fires with carpets and rubber tires to generate heavy clouds of smoke, then they hid behind columns before stepping out of the dark to ambush emerging Saudi troops. The building was turned into a killing zone, and the casualties quickly rose into the hundreds.
"This was a man-to-man confrontation, within a limited space," says Maj Mohammad al-Nufai, the commander of the Ministry of Interior's special forces. "A combat situation with bullets whizzing by, left and right - it's something unbelievable."
A fatwa issued by the Kingdom's main clerics, assembled by King Khaled, cleared the Saudi military to use any degree of force to expel the rebels. Anti-tank guided missiles and heavy guns were then employed to dislodge the rebels from the minarets, and armoured personnel carriers were sent in to breach the gates.
The rebels were galvanised by the Mahdi. "I saw him with two minor injuries under his eyes and his thowb (his dress) was riddled with holes from gunshots," says Abdel Moneim Sultan. "He believed that he could expose himself anywhere out of the conviction that he was immortal - he was the Mahdi, after all."
But Qahtani's belief in his own invulnerability was unfounded and he was soon struck by gunfire.
"When he was hit, people started to shout: 'The Mahdi is injured, the Mahdi is injured!' Some tried to run towards him to rescue him, but the heavy fire prevented them from doing this, and they had to retreat," the anonymous witness says.
They told Juhayman that the Mahdi had been hit, but he declared to his followers: "Do not believe them. They are deserters!"
It was only on the sixth day of fighting that the Saudi security forces managed to take control of the courtyard of the mosque and the buildings surrounding it. But the remaining rebels merely retreated to a labyrinth of hundreds of rooms and cells underneath, convinced by Juhayman that the Mahdi was still alive, somewhere in the building.
Their situation was now dire, though. "The smells surrounded us from the dead or the injuries that had rotted," says the anonymous witness. "In the beginning, water was available, but later on they started to ration supplies. Then the dates ran out so they started eating balls of raw dough... It was a terrifying atmosphere. It was like you were in a horror movie."
Although the Saudi government issued one communiqué after the other announcing victory, the absence of prayers broadcast to the Islamic world told another story. "The Saudis tried tactic after tactic, and it didn't work," says Hambley. "It was pushing the rebels deeper and deeper into the catacombs."
It was clear the Saudi government needed help to capture the leaders alive and put an end to the siege. They turned to French President Valéry Giscard d'Estaing.
"Our ambassador told me that it was obvious the Saudi forces were very disorganised and didn't know how to react," Giscard d'Estaing tells the BBC, confirming for the first time France's role in this crisis.
"It seemed to me to be dangerous, because of the weakness of the system, its unpreparedness and the repercussions this could have on the global oil market."
The French president discreetly dispatched three advisers from the recently formed counter-terror unit, GIGN. The operation had to remain secret, to avoid any criticism of Western intervention in the birthplace of Islam.
The French team was headquartered in a hotel in the nearby town of Taif, from where it devised a plan to flush out the rebels - the basements would be filled with gas, to render the air unbreathable.
"Holes were dug every 50m in order to reach the basement," says Capt Paul Barril, who was in charge of executing the operation. "Gas was injected through these holes. The gas was dispersed with the help of grenade explosions into every corner where the rebels were hiding."
For the anonymous witness, holed up down in the basement with the last of the resisting rebels, the world seemed to be coming to an end.
"The feeling was as though death had come to us, because you didn't know whether this was the sound of digging or of a rifle, it was a terrifying situation.''
The French plan proved successful.
"Juhayman ran out of ammunition and food in the last two days," says Nasser al-Hozeimi, one of his followers. "They were gathered in a small room and the soldiers were throwing smoke bombs on them through a hole they made in the ceiling... That's why they surrendered. Juhayman left and all of them followed."
Maj Nufai witnessed the meeting that followed, between the Saudi princes and a stunned but unrepentant Juhayman: "Prince Saud al-Faisal asked him: 'Why, Juhayman?' He answered: 'It's only fate.' 'Do you need anything?' He just said: 'I want some water.'"
Juhayman was paraded before the cameras, and just over a month later 63 of the rebels were publicly executed in eight cities across Saudi Arabia. Juhayman was the first to die.
While Juhayman's belief in the Mahdi may have set him apart, he was part of a wider movement of social and religious conservatism reacting against modernity, in which hardline clerics gained the upper hand over the royal family.
One man on whom the siege had a profound effect was Osama Bin Laden. In one of his pamphlets against the Saudi ruling family, he said they had "desecrated the Haram, when this crisis could have been solved peacefully". He went on: "I still remember to this day the traces of their tracks on the Haram's floor tiles."
"Juhayman's actions stopped all modernisation," Nasser al-Huzaimi says. "Let me give you a simple example. One of the things he demanded from the Saudi government was the removal of female presenters from TV. After the Haram incident, no female presenter appeared on TV again."
Saudi Arabia remained on this ultra-conservative path for most of the next four decades. Only recently have there been signs of a thaw.
In an interview in March 2018, Crown Prince Mohammed Bin Salman, said that before 1979, "We were living a normal life like the rest of the Gulf countries, women were driving cars, there were movie theatres in Saudi Arabia."
He was referring above all to the siege of the Grand Mosque.