Iran’s controversial former president, Mahmoud Ahmadinejad, is having a bit of a moment on Twitter.
During his stormy eight-year term in office he hit the headlines for calling the Holocaust a “myth”, denying the existence of gay people in Iran – and overseeing a ban on Twitter.
But now he’s back and engaging with users worldwide via an English-language account which he uses to comment on a dizzying range of topics – from American football and Latin American politics, to Serena Williams’ outfits and his own birthday celebrations.
Since he joined Twitter in January 2017, @Ahmadinejad1956 has gathered more than 76,000 followers.
He follows a small but eclectic mix of people, from the Argentine footballer Diego Maradona and US basketball star LeBron James, to Venezuela’s President Nicolas Maduro and David Duke, the former Grand Wizard of the Ku Klux Klan.
Last month, Mr Ahmadinejad prompted a minor media storm with a tweet about US poverty and inequality that quoted lyrics by the American rapper Tupac Shakur (whose parents were Black Panthers) about Huey Newton, co-founder of the Black Panther Party.
So, what’s going on? And how did a man once seen as a stereotypical Iranian hardliner, who left office in 2013, end up speaking to a new generation of politically-active, global social media users?
Key to understanding Mr Ahmadinejad’s tweets are his renewed political ambitions.
The former president has been a highly divisive figure in Iran since 2009, when his disputed re-election triggered the biggest protests in the country since the Islamic Revolution in 1979.
Millions of people demanded a re-run, but the Supreme Leader Ayatollah Ali Khamenei insisted the result was valid and ordered a major crackdown on dissent that saw dozens of opposition supporters killed and thousands detained.
Last year, Mr Ahmadinejad attempted to run for president against the moderate incumbent, Hassan Rouhani, despite being warned by Ayatollah Khamenei that such a move was “not in his interest and that of the country”. In the end, he was barred by the Guardian Council.
However, US President Donald Trump’s decision to abandon the landmark nuclear deal negotiated by Mr Rouhani and reimpose crippling economic sanctions on Iran appears to have presented Mr Ahmadinejad with an opportunity.
Branding himself as a “husband, dad, grandfather, university professor, president, mayor, and proud Iranian”, he has sought to return to the global political stage.
As a non-English speaker, Mr Ahmadinejad is obviously not writing the English-language Tweets himself.
But the sentiments are very much his own.
Throughout his presidency he embraced a very particular personal philosophy – eschewing religious ideology in favour of his own unique blend of Iranian nationalism, anti-imperialism and mysticism.
It was a worldview that drew him to left-wing politics and liberation movements in other countries, and to leaders like Venezuela’s Hugo Chavez and Bolivia’s Evo Morales – often against the wishes of more traditional hardliners in the Iranian establishment.
@Ahmadinejad1956 is clearly aimed mainly at an international audience, but Mr Ahmadinejad also runs accounts in Persian on both Twitter and the messaging service Telegram, which is believed to be used by about 40 million Iranians – almost half the country’s population.
In his native language he is more overtly political, often taking aim at rivals at home.
Last month, he posted online a letter he sent to Ayatollah Khamenei attacking two members of a powerful political family at the heart of the conservative establishment.
He accused Ayatollah Sadeq Larijani, head of the judiciary, and his brother Ali, who is speaker of parliament, of “disrespecting the law”.
“Without evidence, they charge people with serious crimes,” he wrote in the letter. “Judiciary officials comment as if they are a political party.”
For some Iranians, such outspoken challenges to the country’s ruling elite are exactly what they’ve been waiting to hear.
For others, they smack of rank hypocrisy from a man who presided over a crackdown on dissent after the mass protests in 2009.
Whether Mr Ahmadinejad will be able to replicate his popularity online with success in the political sphere remains to be seen.
But at a time of uncertainty at home and abroad, his simple message about the need to stand up for the rights of ordinary people has a renewed appeal.
And in the era of populist politics, Mr Ahmadinejad’s unpredictable and straight-talking “man of the people” style no longer looks so out of place.