Iran has accused the US of "inciting" anti-government protests that have gripped the country, and said the Trump administration had "flouted" international law and the principles of the UN charter by supporting the unrest in a series of "absurd tweets".

In a letter sent to Antonio Guterres, UN secretary-general, on Wednesday, Gholamali Khoshroo, the Iranian ambassador to the UN, said the US had "crossed every limit" by "inciting Iranians to engage in disruptive acts".

"[The US] has stepped up its acts of intervention in a grotesque way in Iran's internal affairs under the pretext of providing support for sporadic protests, which in several instances were hijacked by infiltrators," Press TV quoted Khoshroo as saying.

He criticised US President Donald Trump and Vice President Mike Pence directly for their "numerous absurd tweets", that called on Iranians to "change their government".

"The US Department of State went so far as admitting that the US government wants to encourage protesters in Iran to change their government, admitting that the US is engaged in interfering with the internal affairs of Iran through Facebook and Twitter," Khoshroo said.

The Trump administration is yet to respond to the letter.

At least 22 people have died and more than 450 arrested since anti-government demonstrations erupted across Iran on December 28.

The protests, which have focused on economic and political grievances, have been the largest display of public dissent since pro-reform rallies swept the country in 2009.

Trump, who has banned Iranians from travelling to the US, praised the demonstrators for "finally acting against the brutal and corrupt Iranian regime" in a tweet earlier this week, and warned that "the world is watching".

The people of Iran are finally acting against the brutal and corrupt Iranian regime. All of the money that President Obama so foolishly gave them went into terrorism and into their "pockets." The people have little food, big inflation and no human rights. The U.S. is watching! — Donald J. Trump (@realDonaldTrump) January 2, 2018

Pence has also offered his support for the demonstrators, saying their "rising up ... should hearten every freedom-loving American" in a tweet on Wednesday.

Iran is the leading state sponsor of terrorism in the world. To see the people of Iran rising up to demand change in their country should hearten every freedom-loving American and people who cherish freedom around the world. #IranProtests — Vice President Mike Pence (@VP) January 3, 2018

Nikki Haley, US ambassador to the UN, said on Tuesday that the US would seek an emergency session of the Security Council and the Human Rights Council to discuss the situation in Iran.

"The people of Iran are crying out for freedom," she said. "All freedom-loving people must stand with their cause."

Ayatollah Ali Khamenei, Iran's supreme leader, has blamed external "enemies" for heightening unrest in the country.

Money, weapons, politics and intelligence services have been used by these "enemies" to undermine stability, he said on Tuesday.

Pro-government rallies

Tens of thousands of Iranians took part in nationwide pro-government demonstrations on Wednesday.

The rallies took place in at least 10 cities, including the Iranian capital of Tehran.

TV pictures showed people carrying banners in support of the government and shouting slogans against the US, Israel and Saudi Arabia.

The footage, carried by state media, was in broad contrast to the coverage of the past week's demonstrations against Iran's leadership.

Al Jazeera's Zein Basravi, reporting from Tehran, said, a "few small and short-lived anti-government rallies have taken place overnight Wednesday in a few cities around the country.

"[But] what really is at play today are the pro-government, pro-establishment demonstrations and marches being held in major cities across Iran. This really is an effort by the government to bookend this whole episode.

"It illustrates to a domestic audience, but also to anyone watching from outside, that the government does enjoy support and that there are tens of thousands of people willing to rally on behalf of the government."

Following the demonstrations, General Mohammad Ali Jafari, head of Iran's Islamic Revolutionary Guards Corps (IRGC), declared unrest in the country as over.

"Today, we can announce the end of the sedition," Jafari said, quoted on the Guards' website.

"A large number of the troublemakers at the centre of the sedition, who received training from counter-revolutionaries ... have been arrested and there will be firm action against them," he added.

The UN's human rights chief, Zeid Ra'ad Al Hussein, has urged Iran to handle the situation "with great care" in order to prevent further violence and unrest.

"It is incumbent on the authorities that their actions do not provoke a downward spiral of violence, as occurred in 2009," he said on Wednesday in a statement.

"The authorities must take all steps to ensure that this does not happen again."