The man had embraced the Islamic State group's "ideology" and was found to be in possession of a machine gun, a pistol and multiple rounds of ammunition, the ministry said in a statement.

The man in Al-Bukhariya city was also wearing what appeared to be an explosives-laden belt, state-run Al-Ekhbariya television reported. The incident comes as the kingdom prepares to host the annual hajj pilgrimage from August 19-24.

The kingdom has seen numerous attacks in recent years by jihadists, including Al-Qaeda and the Islamic State group, against security forces. It has also seen clashes between Shiite militants and security forces in the eastern provinces.

In July, a drive-by shooting against a checkpoint in central Saudi Arabia and an ensuing gunfight left a security officer, a Bangladeshi civilian and two attackers dead, according to the interior ministry.