A gunman has opened fire outside a Saudi royal palace, killing two members of the Saudi Royal Guard, an official news agency reported.

The Saudi Press Agency quoted the security spokesman for the Interior Ministry as saying that the attacker got out of a vehicle and opened fire on the western gate of Al-Salam Palace in Jeddah early on Saturday morning, killing two Guard members and wounding three more.

The gunman was shot dead on the spot, according to the report.

The ministry identified the attacker as Mansour bin Hassan bin Ali bin Al Fahid al-Amri, a 28-year-old Saudi national, the report said, adding that he was carrying Kalashnikov rifles and three petrol bombs. It said the investigation is ongoing.

AP