Two Saudi security forces personnel were shot dead and three others were injured on Saturday morning, after a gunman drove up to the gate of the royal palace in Jeddah and opened fire, according to the statement released by the interior ministry.
Reports state that the Royal Guards subsequently killed the gunman, who was identified as Mansour al-Amri, a 28-year-old Saudi national.
"An outpost of the royal guard came under fire by a person who got out of a Hyundai car," the ministry said in a statement carried by the official Saudi Press Agency.
"He was immediately dealt with and his cowardly act also resulted in the martyrdom of two royal guards," it added.
The incident reportedly occurred at a checkpoint outside the western gate to the Peace Palace in Jeddah. The royal family usually conducts its official business in this palace during the summer months, according to Reuters.
The United States embassy in Saudi Arabia had reportedly cautioned its citizens over reports of the attack.
"Due to the possibility of ongoing police activity, American citizens are advised to exercise caution when travelling through the area," the embassy said in a brief statement.
Saudi King Salman is currently outside Saudi Arabia on a state visit to Russia. The interior ministry statement, however, did not elaborate on the whereabouts of Saudi Crown Prince Mohammed bin Salman. According to state news reports, the Crown Prince was in Jeddah when the incident occurred.
Reports state that the security forces found Kalashnikov rifles and petrol bombs in the gunman's possession.
The Interior Ministry spokesperson Mansour al-Turki said that the gunman did not have a criminal record or any known links with extremist groups, according to al-Arabiya television reports.
Turki said that an investigation has been launched to determine the motive of Amri's attack on the royal palace guards.