Saudi Arabia says it has foiled a "terrorist action" against the Grand Mosque in Mecca - Islam's holiest site.
Millions of Muslims from around the world have gathered in Mecca for the end of Ramadan.
The interior ministry said a suicide bomber blew himself up when security forces surrounded the building he was in.
The building collapsed, injuring 11 people, including police officers. Five other suspected militants have been taken into custody, officials say.
Saudi officials released no further details about the foiled attack.
Saudi Arabia has in recent years seen a series of deadly attacks, many of which were claimed by so-called Islamic State.
Most assaults have targeted the country's Shia minority and security forces.
In July 2016, four security officers were killed in a suicide attack near the Prophet's Mosque in Media.
Saudi Arabia is a member of a US-led coalition fighting IS and other jihadist groups in Syria and Iraq.
- BBC