Iran's former President wrote an open letter to US President Donald Trump.

Iran's ex-president Mahmud Ahmadinejad published Sunday an open letter to Donald Trump, welcoming his criticism of the US political system but taking issue with his visa ban and attitude to women.Many Iranians see the new US president as cut from the same cloth as Ahmadinejad, who shocked the establishment with his sudden rise to power in 2005, combining hardline rhetoric and populist economic policies to win a powerful following among Iran's lower classes.At times in the long and rambling letter, published in English and Farsi on his website, he appears to find a kindred spirit in Trump."Your Excellency (Trump) has truthfully described the US political system and electoral structure as corrupt and anti-public," he writes.But much of the letter is spent exhorting Trump to end interventions in the Middle East and ditch the "arrogance" of past US administrations.Ahmadinejad also takes issue with Trump's visa ban on seven Muslim-majority countries, including Iran."The presence and constructive effort of the elite and scientists of different nations, including the million-plus population of my Iranian compatriots has had a major role in the development of the US... the contemporary US belongs to all nations."He also finishes with a short lecture on respecting women -- a possible reference to Trump's recorded claims that he has sexually assaulted some."The great men of history have paid the highest level of respect to women and recognised their God-given capabilities," Ahmadinejad writes.Ahmadinejad has a fondness for writing to world leaders, having sent letters to former US president Barack Obama, German Chancellor Angela Merkel and the pope -- as well as an 18-page missive to previous US leader George W. Bush.When Trump was elected in November, many Iranians joked about the similarities to their former president, whose tenure ended in 2013.

"When Ahmadinejad said that he intended to export his method of managing the world, we didn't take him seriously..." wrote one bemused commenter on social media.