Riyadh: Six foreign pilgrims were hurt on Friday in Saudi Arabia when a suicide bomber targeting Islam's holiest site of Makkah blew himself up, the Interior Ministry said.

The incident happened around the Grand Mosque, where hundreds of thousands of worshippers gathered for early afternoon prayers on the last Friday of this year's Ramadan, the Muslim fasting month.

Ministry spokesman General Mansour Al Turki told Saudi television that police "foiled the terrorist plan that targeted the security of the Grand Mosque, pilgrims and worshippers."

In dawn raids on Makkah and the Red Sea city of Jeddah officers arrested five suspects, including a woman, before surrounding the bomber's location around the Grand Mosque.

"Unfortunately he started shooting towards security personnel once he noticed their presence in the area, which led to an exchange of fire before he blew himself up," Turki said.

The blast partially collapsed the building where he had taken refuge, injuring the six pilgrims, Turki said.

He added that four had already been released from hospital, and five security men were also slightly hurt.

State television Al Arabiya TV reported that security forces had found two groups of terrorists in Makkah and a third group in the city of Jeddah. The foiled attack targetted worshipers at the mosque, it said.

The first operation was foiled in Makkah in Assila district, while the second was thwarted in Ajyad Al Masafi neighbourhood.

A suicide bomber, who was hiding in a house in the Ajyad neighbourhood, opened fire on security forces and refusing to comply with calls to turn himself in. He later blew himself up after a crackdown on him.