Grand Mosque Mecca
General view of the Kaaba at the Grand Mosque in Mecca, Saudi Arabia September 9, 2016.Reuters

Saudi Arabia's Interior Ministry said on Friday that security forces foiled a suicide attack on the Grand Mosque in the holy city of Mecca. The forces cornered the suspected attacker in an apartment, where he blew himself up, the ministry added.

Three cells had planned the suicide attack on worshippers and security forces, who had gathered at the Grand Mosque to offer prayers as the holy month of Ramadan is slowly coming to an end, the Interior Ministry said in a statement read on state television.

The suicide bomber got involved in a gunbattle with the security forces following which he detonated the explosives after the apartment he was hiding was surrounded, located close to the mosque in the Ajyad al-Masafi neighbourhood of central Mecca.

Mecca Blast
Saudi security forces work at a scene after a suicide bomber blew himself up in Mecca, Saudi Arabia June 23, 2017.Reuters

Six foreigners and five security personnel got injured when the building collapsed after the would-be attacker blew himself up, the ministry said. No terror group has claimed responsibility for the attack yet. However, the Islamic State group had carried out attacks in Saudi Arabia in the past.

Security forces had, earlier in the day, also shot dead a man who was wanted in another suspected Islamist militant hideout in Mecca's al-Aseelah neighbourhood, Reuters reported. The Interior Ministry said that a security personnel had broken up the third cell in Jeddah's Red Sea city. Five suspected terrorists, including a woman, were arrested, the ministry added without giving any further details.

The holy month of Ramadan ends with Eid-al-Fitr. Monarchs in Saudi Arabia usually spend the last 10 days of the fasting month in the holy city of Mecca.