ALSO READSaudi Arabia foils terror attack against palace in Jeddah Stopped attack on major offshore oilfield, claims Saudi Arabia Fresh evidence reveals Saudi govt funded 'dry run' for 9/11 attack 12 dead in Iran: IS claims responsibility for attacks on parliament, shrine Saudi to impose family tax: What it means to 41 lakh Indians & their kins
The gunman, who opened fire at the al-Salam royal palace in the Red Sea city of Jeddah, Saudi Arabia, was killed by palace guards.
The attacker was identified him as Mansour al-Amri, a 28-year-old Saudi national.
According to the security spokesperson for the Saudi Arabia's Interior Ministry, the attacker opened fire on the western gate of Al-Salam Palace in Jeddah, killing two guard members and injuring three others.
The victims have been identified as Agent Sergeant Hammad bin Shallah al-Mutairi and First Soldier Abdullah bin Faisal al-Subaie, the Saudi Ministry said.
The gunman had driven up to the gate of the palace and opened fire on the guards.
An AK-47 and thee Molotov cocktails were found on his person after the attack, the al-Arabiya news agency reported.
"Due to the possibility of ongoing police activity, American citizens are advised to exercise caution when travelling through the area," the embassy warned in a statement.
According to the national security agency, the warning came after the Saudi Police raided hideouts of a suspected terror cell linked to the Islamic State group this week, killing two people and arresting five.