The man, in his 40s and a Saudi citizen, "poured petrol on himself and tried to set it alight," Grand Mosque police spokesman Major Sameh al-Salami said.
"His behaviour gives the impression that he is mentally disturbed."
The incident happened last night right next to the Kaaba, the cubic stone structure at the heart of the mosque towards which Muslims pray.
Pilgrims and police escorted the man away before he could light the petrol, footage posted on social media showed.
Also Read
One witness told the Sabq news website that the man had been uttering "takfiri" slogans, referring to extremist Islamist groups blamed for numerous attacks worldwide.
The huge flow of pilgrims into the Grand Mosque makes security checks at the gates extremely difficult.
In November 1979, the Grand Mosque was seized by more than 400 fundamentalists led by Saudi Juhayman al-Oteibi who claimed to have with them the redeemer -- the mahdi.
They seized pilgrims as hostages and it took special forces a fortnight of fierce gun battles to retake the mosque compound.
Disclaimer: No Business Standard Journalist was involved in creation of this content