Saudi security forces have foiled a terror plot targeting the Grand Mosque in the Muslim holy city of Mecca after a suspect blew himself up after a gunfight.

Saudi Arabia's Interior Ministry said security forces exchanged gunfire with one of the suspects, who blew himself up inside a home he was hiding in yesterday.

Five people, including a woman, were arrested in security operations in Mecca, Saudi Interior Ministry spokesman Mansour al-Turki said.

The Interior Ministry added that the attack on the mosque was being planned by three terrorist groups, two based in Mecca and a third in Jeddah.

Scroll down for video

Saudi security forces foiled a terror plot targeting the Grand Mosque in the Muslim holy city of Mecca, exchanging gunfire with suspects

Pictured: Saudi security forces on the ground after the shootout

Pictured: A still from a video broadcast on Saudi state television showing the evacuation of the wounded

The Interior Ministry said an attack on the mosque was being planned by three terrorist groups, two based in Mecca and a third in Jeddah

One suspect blew himself up and a further five have been arrested, Saudi intelligence chiefs revealed

Al-Arabiya said a suicide bomber hiding in a house in the Ajyad al-Masafi neighborhood of Mecca opened fire on security forces and later blew himself up on the eve of Ramadan.

Five security forces members and six other people - the latter all foreigners - were injured in the attack.

The Grand Mosque houses Islam's holiest site, the cube-shaped Kaaba that Muslims pray towards five times a day. The holy month of Ramadan ends this evening.

Saudi Arabia's regional rival Iran has condemned a plot to target the Grand Mosque in Mecca.

The Grand Mosque houses Islam's holiest site, the cube-shaped Kaaba that Islam's followers pray toward five times a day

Iran's Foreign Ministry issued a statement Saturday quoting spokesman Bahram Ghasemi as saying 'terrorism is rampant and growing now across the whole world.'

He called on all nations to 'be cautious' and said that Iran is ready to help other countries in confronting militants.

Saudi state television has aired footage after the raid near the Grand Mosque in Mecca, showing police and rescue personnel running through the neighborhood's narrow streets where security forces confronted a suicide bomber.

TERRORISTS INCREASINGLY TARGETING MUSLIMS MARKING THE END OF RAMADAN Muslims from around the world flock to Mecca annually for the end of the holy fasting month of Ramadan. Terrorist attacks targeting the thousands of Muslims who congregate in Saudi Arabia have intensified since 2014, including blasts at holy sites such as the Prophet's Mosque in Medina. A similar attack in July last year occurred when four security officers were killed and five others wounded in a suicide bombing outside the Prophet's Mosque. It was the third attack to hit that day - including blasts in Jeddah and Qatif. The blast targeted Muslims as they knelt in prayer - an attack which the US Central Intelligence Agency said was typical of ISIS. ISIS claimed responsibility for another attack at a mosque in the city of Abha in August 2015 where fifteen people were killed But attacks during Ramadan and targeting mosques are not exclusive to the Middle East. Muslim worshippers were attacked while leaving Finsbury Park Mosque in London, leaving one man dead and several injured. Advertisement

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

What appeared to be shrapnel and bullet holes peppered nearby structures.

It is not yet clear who was behind the terror plot, but the Islamic State group has previously carried out similar mosque attacks in the kingdom.

The US Central Intelligence Agency said previous recent attacks bore the hallmarks of ISIS.

Most of the targets in Saudi Arabia have been the Shiite minority and security forces, killing dozens of people.

ISIS leader Abu Bakr al-Baghdadi has called for attacks against the kingdom, a member of the US-led coalition battling the group in Syria and Iraq.