BEIRUT: Iraninfo-icon has foiled attempts by its foreign enemies to turn legitimate protests into an insurgency to overthrow the Islamic Republic, supreme leader Ayatollah Ali Khamenei said on Tuesday.

Comments on his Twitterinfo-icon feed and in Iranian mediainfo-icon underscored the establishment's confidence that it has extinguished the unrest that spread to more than 80 cities in which at least 22 people died since late December.

"Once again, the nation tells the USinfo-icon, Britaininfo-icon, and those who seek to overthrow the Islamic Republic of Iran from abroad that 'you've failed, and you will fail in the future, too.'" Khamenei tweeted.

Embedded rich media on Twitter

The Revolutionary Guards, the military force loyal to Khamenei, said on Sunday security forces had put an end to the unrest that it too said had been whipped up by foreign enemies.

At least 1,000 people have been arrested in the biggest anti-government protests for nearly a decade, with the judiciary saying ringleaders could face the death penalty.

A judiciary official announced on Tuesday that a detainee in Arak, a town approximately 200 km south of Tehraninfo-icon, had died after committing suicide, according to Mizan, the website of the Iranian judiciary.

On Monday, a separate judiciary official announced that a detainee had committed suicide in Tehran's Evin prison.

The reports have raised concerns among human rightsinfo-icon activists and some Iranian politicians that detainees may have been killed by security forces while in custody.

"I warn the president and security and judiciary officials to prevent the occurrence of a second Kahrizak," Mahmoud Sadeghi, a parliamentarian, tweeted on Monday. The Kahrizak prison gained notoriety when a handful of detainees were killed and tortured at the site after unrest in 2009.

Khamenei said US President Donald Trumpinfo-icon was grandstanding when he tweeted support for protesters he said were trying "to take back their corrupt government" and promising "great support from the United Statesinfo-icon at the appropriate time!" As well as Washington and London, Khamenei blamed the violence on Israelinfo-icon, exiled dissident group People's Mujahedin of Iran and "a wealthy government" in the Gulf, a probable reference to Iran's regional rival, Saudi Arabiainfo-icon.

In a rare public appearance, the head of Israeli intelligence agency Mossad said the protests were due to Iranian President Hassan Rouhani's failure to improve people's economic or social circumstances, but he said they were unlikely to overthrow the establishment.

"In Iran too, we have eyes and ears," Yossi Cohen told a Finance Ministry conference in Jerusaleminfo-icon. "One shouldn't develop high hopes, though I would be happy to see a meaningful revolution," he added.

Khamenei has called the protests -- which were initially about the economyinfo-icon but soon turned political -- "playing with fireworks", but he said citizens had a right to air legitimate concerns, a rare concession by a leader who usually voices clear support for security crackdowns.