(Adds Saudi ambassador in Lebanon on Beirut bombing)
RIYADH, June 26 (Reuters) - King Abdullah ordered all necessary measures to protect Saudi Arabia against potential "terrorist threats" after chairing a security meeting to discuss the fall-out from Iraq, the state news agency SPA said on Thursday.
The world's top oil exporter shares an 800-km (500-mile) border with Iraq, where the militant Islamic State in Iraq and the Levant (ISIL) and other Sunni Muslim groups have seized towns and cities in a lightning advance this month.
Riyadh has long expressed fears of being targeted by jihadists, including some of its own citizens, who have taken part in conflicts in Iraq and Syria, and earlier this year decreed long jail terms for those who travel overseas to fight.
"Concerned for the national security of the kingdom of Saudi Arabia against any measures that terrorist organisations or any other groups might resort to ..., (the king) has ordered all necessary measures to protect the gains of the homeland and its stability, and the security of the Saudi people," SPA said.
King Abdullah acted a day before he was due to meet U.S. Secretary of State John Kerry in Jeddah to discuss the crisis in Iraq and Syria, and a day after two Saudi men were involved in a suicide bombing in Lebanon.
The Saudi ambassador in Lebanon said on Thursday he was not able to rule out that Wednesday's attack in a Beirut hotel, which killed one of the Saudis and injured three security guards, was intended to target the embassy, located nearby.
Sunni Muslim Saudi Arabia has been one of the biggest supporters of mainly Sunni rebels in Lebanon's neighbour Syria fighting against President Bashar al-Assad, who is backed by Riyadh's main regional adversary, Shi'ite Muslim Iran.
However, it has shied away from arming rebel groups like ISIL that it fears are connected to al Qaeda, which waged a campaign of attacks inside the kingdom a decade ago led by veterans of jihad in civil wars in Iraq and Afghanistan.
Saudi Arabia's envoy in Lebanon, Ali Awad Asiri, said it was important to find out who was behind Wednesday's bombing in Beirut, in which local security forces said the Saudi bomber was killed and another Saudi wounded and then arrested at the scene.
"We want to know why a Saudi citizen was involved in such a criminal act," Asiri told television channel al-Hadath. His comment that the attack may have been directed at the Saudi embassy came in a later interview broadcast on the al-Arabiya channel.
"We need to know how they were lured into this, who finances them, why they were in that place to carry out this criminal act. We have special ties with the security forces in Lebanon and the Lebanese government," he said.
(Reporting by Sami Aboudi in Dubai and Sylvia Westall in Beirut; Writing by Angus McDowall; Editing by John Stonestreet)