(afp) -- 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 Mecca 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.
.