FILE PHOTO: Iran's Supreme Leader Ayatollah Ali Khamenei speaks live on television after casting his ballot in the Iranian presidential election in Tehran June 12, 2009. REUTERS/Caren Firouz//File Photo

DUBAI (Reuters) - Iran’s supreme leader on Wednesday accused the United States and Saudi Arabia of stoking unrest in Lebanon and Iraq, saying Tehran understood the situation in those countries because it had had to suppress similar foreign interference at home.

“The U.S. and Western intelligence services, with the financial backing of reactionary countries in the region, are spreading turmoil,” Ayatollah Ali Khamenei was quoted by his official website as telling graduating army cadets.

Khamenei urged protesters to seek changes in a lawful way in Iraq and Lebanon, where Iran has powerful allies among Shi’ite Muslim government factions.

In an apparent warning, Khamenei praised Iran’s crackdown against street protests at home in 2018.

“They (U.S. and Saudi Arabia) had similar plans for our dear country, but fortunately the people... came out in time and the armed forces were ready and that plot was neutralized,” Khamenei said, in a reference to the protests which were put down by security forces while authorities held pro-government rallies.

Iran’s weeks-long unrest in 2017-2018 began as protests about economic hardship and corruption but grew into political rallies, some of which criticized Khamenei by name.

They were the boldest challenge to Iran’s leadership since 2009, when security forces crushed a pro-reform uprising and killed dozens of protesters.

“Our advice has always been to call for peace and (stopping) interference by foreign forces in these countries (Iraq and Lebanon),” President Hassan Rouhani’s chief of staff Mahmoud Vaezi was quoted as saying earlier by state media.

The United States, Saudi Arabia and Israel were riding a wave of popular demands and providing those forces with financial support, he added.