Iranian conservatives called on former president Mahmoud Ahmadinejad to stay out of next year's election following a speech by supreme leader Ayatollah Ali Khamenei on Monday.
In a cautiously worded statement ahead of a theological class, Khamenei said: "A certain person came to me and I told him not to do a certain thing, believing it would be to the benefit of both the person himself and the country."
Although he did not mention Ahmadinejad by name, several conservative figures interpreted his words as a rebuke to the controversial former president who led the country from 2005 until the 2013 presidential election.
"Mr Ahmadinejad must be very thankful and grateful for the leader's advice and he will definitely listen to this advice and not run for the election, and will be of service to people in some other position," said Mohammad Gharavian, a cleric in the holy city of Qom, according to ISNA news agency.
Ahmadinejad has made numerous public appearances in recent months, leading to speculation that he was planning a comeback in the presidential election next May.
Khamenei implied that such a move would create "a bi-polar atmosphere" that would "damage the country".
Ahmadinejad's inflammatory rhetoric -- particularly regarding Iran's nuclear programme and hostility towards Israel -- was blamed for deepening tensions with the West, but his populist approach and humble roots means he has retained popularity with poorer sections of Iranian society.
By the end of his term, he had alienated even the conservative establishment and faced wide-ranging criticism over his handling of the economy and failure to show sufficient deference to the supreme leader.
President Hassan Rouhani, a moderate who oversaw a deal with world powers to end sanctions in exchange for curbing Iran's nuclear programme, is expected to run for a second term, although he faces mounting pressure from conservatives who say the deal has brought few benefits to Iran.