The gunman was killed after refusing to surrender to security forces hunting him over his suspected involvement in an attempt to infiltrate a police station parking area in the province on Sunday, a ministry statement said.
It identified him as Mohammed al-Maliki, adding that he had threatened in a video message to attack police and had been involved in a previous attack in which a policeman was killed.
4 dead in Saudi raid on 'terror' cell near Makkah
The past week has seen a rise in such incidents in the kingdom, where the Islamic State group (IS) has previously claimed bombings and other attacks targeting security forces.
On Thursday, a police officer was shot dead after four suspected militants died during a raid in the area between Taif and the region of Mecca, home to Islam's holiest sites.
IS leader Abu Bakr al-Baghdadi has called Saudi Arabia's rulers "apostate tyrants" and called on Saudis to rise up against them.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ