Saudi security forces shot and killed a gunman who had stopped his car near the US consulate in Jeddah on Wednesday.
When security authorities saw the man was carrying a weapon, they exchanged fire with him and he was shot dead.
"A person in a car stopped near the American consulate building in Jeddah Governorate and got out of it carrying a firearm in his hand," a spokesman for the Makkah regional police said.
"So security authorities took the initiative to deal with him as required, and the exchange of fire resulted in his death."
A Nepalese security guard at the consulate was also injured and died of his wounds, state news agency SPA reported.
"The US embassy and consulate remain in contact with Saudi authorities as they investigate the incident," a US State Department representative said in a statement.
No Americans were harmed in the incident, the representative said.
Investigations are under way to ascertain the circumstances surrounding the incident.
News agencies contributed to this report