Saudi security services thwarted a suicide bomber planning to launch a terror attack at the Grand Mosque in Mecca on the last Friday of Ramadan, according to the country’s Interior Ministry.

Eleven people were injured when a suspect blew himself up after exchanging gunfire with security forces during a tense standoff near Islam’s holiest site, it is claimed.

The man had refused to surrender and opened fire when officers tracked him down and found him hiding in a home in the neighbourhood of Ajyad Al Masafi, in Mecca, on Friday.

Six foreign pilgrims were hurt in Saudi Arabia when a suicide bomber targeting Islam's holiest site of Mecca blew himself up, the Interior Ministry said. (AFP)

He was part of a terrorist cell plotting to bomb worshippers gathering to pray at the world’s largest mosque, the Saudi Interior Ministry claimed.

Saudi state television aired footage after the raid, showing police and rescue personnel running through the narrow streets.

The blast demolished the building, and its walls crushing a parked car.

Muslim pilgrims begin rituals in Mecca ahead of hajj

Nearby structures appeared to be peppered with shrapnel and bullet holes.

The Interior Ministry said the thwarted “terrorist plan” would have violated “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,” it said.

In pictures: Ramadan around the world Show all 27 1 /27 In pictures: Ramadan around the world In pictures: Ramadan around the world In pictures: Ramadan around the world In pictures: Ramadan around the world Russia Russian Muslims pray outside the central mosque in Moscow, during celebrations of Eid al-Fitr marking the end of the fasting month of Ramadan AFP/Getty Images In pictures: Ramadan around the world Turkey Turkish Muslims offer Eid al Fitr prayers as they mark the first day of the Eid al-Fitr at Fatih Sultan Mosque in Istanbul Getty Images In pictures: Ramadan around the world Syria A Syrian Dervish dances as part of a traditional event organised by the Syrian Ministry of Tourism under the title 'Music and Dervishes' in the old city of Damascus EPA In pictures: Ramadan around the world Bosnia and Herzegovina A Bosnian Muslim man, wearing a traditional Bosnian outfit, fires a canon from a vantage point overlooking Sarajevo to mark the end of daily fasting on the final day of the Islamic holy month of Ramadan AFP/Getty Images In pictures: Ramadan around the world Pakistan A general view of an illuminated Mosque as Muslims pray during the 27th night of Ramadan, in Peshawar EPA In pictures: Ramadan around the world Pakistan Muslim women offer prayer of the Jumat-ul-wida, the last Friday of the Islamic holy month of Ramadan at a mosque in Lahore AP In pictures: Ramadan around the world India Muslims offer prayers on the last Friday of the holy month of Ramadan in Dargah Khwaja Moinuddin Chisti Rex Features In pictures: Ramadan around the world Saudi Arabia The Prophet Mohammed Mosque in the holy city of Medina, during Ramadan EPA In pictures: Ramadan around the world Malaysia A Malaysian swings around fireworks to celebrate the last day of the Muslims' Holy fasting month of Ramadan, in Shah Alam, outside Kuala Lumpur In pictures: Ramadan around the world Kyrgyzstan Kyrgyz Muslims pray during the Eid al-Fitr Muslim celebration marking the end of Ramadan in Bishkek EPA In pictures: Ramadan around the world Ivory Coast People pray during the Laylat Al Qadr prayers on the 27th day of the Islamic month of fasting, Ramadan in the front of the Aghin mosque in Abidjan AFP/Getty Images In pictures: Ramadan around the world Syria Syrians shop for traditional sweets in Kafr Batna in the rebel-held Eastern Ghouta area, on the outskirts of the capital Damascus, ahead of Eid al-Fitr which marks the end of the Muslim holy month of Ramadan AFP/Getty Images In pictures: Ramadan around the world Israel A Palestinian woman prays on the third Friday of the holy fasting month of Ramadan on the compound known to Muslims as Noble Sanctuary and to Jews as Temple Mount in Jerusalem's Old City REUTERS In pictures: Ramadan around the world Iran Iranian Shiite Muslims pray at the graves of soldiers who were killed during 1980-88 Iran-Iraq War, at the Behesht-e-Zahra cemetery, during the holy fasting month of Ramadan, just outside Tehran, Iran AP In pictures: Ramadan around the world Israel A Palestinian man pours water on Muslim worshippers' heads to cool off in the heat, as others pray outside the Dome of the Rock at the al-Aqsa Mosque in Jerusalem during the last Friday prayers of the Muslim holy month of Ramadan EPA In pictures: Ramadan around the world Afghanistan Afghan women wait to receive food ration during the Muslim holy month of Ramadan in Herat EPA In pictures: Ramadan around the world Pakistan A Pakistani Muslim reads the holy Koran as he observes Itikaf at a Mosque, in Peshawar EPA In pictures: Ramadan around the world India Kashmiri Muslim women offer prayers as the head priest (not pictured) displays a holy relic believed to be hair from the beard of the Prophet Mohammed, during special prayers to observe the Martyr Day of Hazrat Ali, cousin of Prophet Mohammed, on the 21st day of Ramadan, at the Hazratbal Shrine in Srinagar, the summer capital of Indian Kashmir EPA In pictures: Ramadan around the world India Indian Muslims sit with bowls of porridge(Nombu kanji)as they prepare to break the fast with the Iftar meal during the Islamic month of Ramadan at The Wallajah Big Mosque in Chennai AFP/Getty Images In pictures: Ramadan around the world Lebanon Spectators watch fireworks as a giant Fanous, or Ramadan lantern, is switched on four days before the start of Ramadan month in front of Mohamed al-Amine Mosque in downtown Beirut EPA In pictures: Ramadan around the world Lebanon Lebanese children perform during activities celebrating the upcoming Muslim holy month of Ramadan, in downtown Beirut AP In pictures: Ramadan around the world Palestine Palestinian men drink tea on the promenade of Gaza beach Getty In pictures: Ramadan around the world Indonesia Members of Nahdlatul Ulama, the biggest Muslim organisation in Indonesia, hold a mass prayer session to welcome in Ramadan in Jakarta AFP/Getty In pictures: Ramadan around the world Iraq Iraqis shop for food in a preparation for the Muslim holy month of Ramadan in Baghdad AP In pictures: Ramadan around the world Indonesia Foods is seen during 'Unggah-unggahan' ceremony to welcome in the Muslim fasting month of Ramadan in Pekuncen village Getty

A second attack was foiled when five suspects, including one woman, were arrested during separate security operations that day, according to Saudi-owned news website Al-Arabiya.

The attacks were allegedly planned by three terrorist groups based in Mecca and Jeddah, though it is not yet certain who was behind the plots.

Isis has previously targeted Saudi Arabia because they are a member of the US-led coalition fighting the proscribed organisation in Iraq and Syria.

They claimed responsibility for a blast at a mosque in the city of Abha, which killed 15 people in August 2015.

Another suicide bomber killed four security officers near the Prophet’s Mosque in Medina in July 2016.

Millions of Muslims from across the world have travelled to Mecca during the holy fasting month Ramadan.

Worshippers pray facing a cube-shaped shrine inside the Grand Mosque called the Kaaba, which is considered Islam’s holiest site.

The Grand Mosque has been the target of militants before, in part because it represents a symbol of the ruling Al Saud family’s clout in the Islamic world.

The Saudi monarch bears the title of “custodian of the two holy mosques.”

In 1979, 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.