A suicide bomber blew himself up near the Grand Mosque at Mecca as police disrupted a plot to target the holiest site in Islam just as the fasting month of Ramadan ends, Saudi security forces said.
The Interior Ministry said it launched a raid in Jiddah province, as well as two areas in Mecca itself, including the Ajyad Al-Masafi neighbourhood, located near the Grand Mosque.
There, police said they engaged in a shootout at a three-storey house a suicide bomber, who blew himself up and led to the building's collapse on Saturday, said news.com.au.
He was killed while the blast wounded six foreigners and five members of security forces, according to the Interior Ministry's statement.
Five others were arrested, including a woman, it said.
Saudi state television aired footage after the raid near the Grand Mosque, showing police and rescue personnel running through the neighbourhood's narrow streets.
The blast demolished the building, its walls crushing a parked car as what appeared to be shrapnel and bullet holes peppered nearby structures.
The Interior Ministry "confirms that this terrorist network, whose terrorist plan was thwarted, violated, in what they would have perpetrated, all sanctities by targeting the security of the Grand Mosque, the holiest place on Earth."
"They obeyed their evil and corrupt self-serving schemes managed from abroad whose aim is to destabilise the security and stability of this blessed country," the statement said.
The ministry did not name the group involved in the attack.
The ultraconservative Sunni kingdom battled an al-Qaeda insurgency for years and more recently has faced attacks from a local branch of the Islamic State group.
Neither group immediately claimed those arrested, though Islamic State sympathisers online have urged more attacks as an offensive in Iraq slowly squeezes the extremists out of Mosul and their de facto capital of Raqqa in Syria comes under daily bombing from a U.S.-led coalition.
NEW CROWN PRINCE
The disrupted attack comes at a sensitive time in Saudi Arabia as King Salman earlier this week short-circuited the kingdom's succession by making his son, Defense Minister Mohammed bin Salman, first in line to the throne.
The newly appointed crown prince, 31 years old, is the architect of Saudi Arabia's war in Yemen against Shiite rebels, now stalemated.
He has also offered aggressive comments about the kingdom confronting Shiite power Iran.
Meanwhile, Saudi Arabia and other Arab countries have cut diplomatic ties to neighbouring Qatar and are trying to isolate the energy-rich tiny country over its alleged support of militants and ties to Iran. Qatar long has denied those allegations.
As the Interior Ministry announced the raid, over one million Muslim faithful prayed at the Prophet's Mosque in Medina to mark the end of Ramadan.
In July 2016, a suicide bombing there killed four members of Saudi Arabia's security forces. Millions of Muslims from around the world visit the mosque, the burial site of the Prophet Muhammad, every year as part of their pilgrimage to Mecca.
The Grand Mosque has been the target of militants before, in part as it represents a symbol of the ruling Al Saud family's clout in the Islamic world.
King Salman is known as the "custodian of the two holy mosques," a title used by the monarchs before him as well.
In 1979, some 250 militants seized the mosque and held it for two weeks as they demanded the royal family abdicate the throne.
When Saudi troops stormed the mosque, the official death toll was 229, including extremists and soldiers.