Qatar has condemned an attack on a palace guard post in the western Saudi city of Jeddah, which left two security officers dead.

Saudi officials said an attacker drove up to the gates of the palace on Saturday before opening fire with a Kalashnikov assault rifle, injuring three others before being shot dead by royal guards.

In a statement on Sunday, the Qatari Ministry of Foreign Affairs said it "strongly condemned and denounced the attack" and sent condolences to the families of those who had died.

"The Foreign Ministry reiterated Qatar's firm position rejecting violence and terrorism regardless of their motives or reason," the statement read.

The attacker was named by the Saudi Interior Ministry as 28-year-old Saudi national, Mansour al-Amri.

The palace, where the royal family conducts official business during the summer months, is located next to the King Abdulaziz Road and Andalus Road on the waterfront of the Red Sea coastal city.

Saudi King Salman is currently outside the kingdom on a state visit to Russia.

ISIL threat

Saudi Arabia has faced a renewed threat of attacks since the Islamic State of Iraq and the Levant (ISIL) group came to prominence in 2014.

The group and its supporters have carried out a spate of attacks in the kingdom against security forces and members of the country's Shia minority.

In 2015, 26 people were killed in two separate attacks on Shia mosques in the Qatif region.

Saudi Arabia is part of an international coalition targeting ISIL with air raids in Syria.