Iran's former President Mahmoud Ahmadinejad has launched a political campaign ahead of February's parliamentary elections in what could prove a challenge to the moderates behind a landmark nuclear agreement reached last month.

Few expect a rerun of Ahmadinejad's surprise victory in the 2005 elections, which kicked off an eight-year presidency marked by confrontation with the West, incendiary rhetoric toward Israel and refusal to compromise on the disputed nuclear program. Many former allies have turned on Ahmadinejad, and two of his former vice presidents have been jailed for corruption.

But the unapologetic populist is believed to command strong support in the countryside, and could be seen by Iran's Supreme Leader Ayatollah Ali Khamenei as a counterbalance to the reformers who have tried to reverse Ahmadinejad's confrontational legacy since the election of President Hassan Rouhani, a moderate, two years ago.

At a gathering of his supporters Thursday, Ahmadinejad, 58, broke two years of silence, vowing to "redefine revolutionary ideals" laid out by the leader of Iran's 1979 revolution, the late Ayatollah Ruhollah Khomeini.

"God willing, victory and a very bright future awaits us. However, there will be bumps and satanic obstacles in our path," the diminutive former leader, sporting his trademark close-cropped beard and sports coat, told some 400 supporters in Tehran. "One should not forget that the U.S. is our enemy."

He called on his supporters to "begin working energetically in the provinces." He remains popular among the rural poor because of his government's decision to provide monthly cash handouts after cutting food and energy subsidies, and because of his condemnation of capitalism and injustice. During his presidency he received thousands of letters a day from ordinary Iranians, and earlier this week people lined up outside his Tehran residence to ask for assistance, a reflection of his populist touch.

Open gallery view Former Iranian President Mahmoud Ahmadinejad, second left, reads a petition for help from a woman while others wait in queue outside his house in northeastern Tehran, Iran, Monday, Aug. 3, 2015. Credit: AP

But many middle and upper class Iranians, even in small towns, blame the crippling international sanctions over Iran's nuclear program on his bombastic anti-Western rhetoric. And the current government is in the process of removing millions of wealthy citizens from the welfare rolls to ease a budget crisis caused in part by the sanctions and plunging oil prices.

Ahmadinejad has not commented on the nuclear deal, which would lift painful international sanctions in return for Iran curbing its nuclear activities. He could do little to derail the agreement, particularly if it enjoys the support of the supreme leader. But a strong showing by Ahmadinejad's supporters in February's election could hinder any push for a broader rapprochement between Iran and the United States, and lay the groundwork for his return to the presidency.

Former Deputy Foreign Minister Sadeq Kharrazi, a reformist politician, said Ahmadinejad's political career is over but that "Ahmadinejadism" - his unique melding of economic populism with a hawkish foreign policy - remains a "threat to the country."

In the absence of reliable polling, it's impossible to gauge Ahmadinejad's level of support. Any comeback would depend on Khamenei, who along with his hand-picked appointees vets candidates for parliamentary and presidential elections.

"The key is the ruling system's decision on how to deal with Ahmadinejad," political analyst Saeed Leilaz said.

"He can't reappear without approval from the top echelons of power," he added. "His comeback means Khamenei wants to use him as a counterbalance to control reformists in the upcoming elections."

The unprecedented nuclear deal has bolstered Rouhani and Iran's moderate camp. Leilaz said the ruling system hopes parliamentary elections will slow its rise by dividing the seats more or less equally among moderates, conservatives and hard-liners. Conservatives fear that the moderates will open the country to an influx of Western culture that would dilute its Islamic values. Hard-liners fear that the nuclear deal will lead to a broader rapprochement with the United States, which they still view as a "Great Satan," determined to dismantle the Islamic republic.

Many conservatives and hard-liners turned on Ahmadinejad in the latter years of his rule, but they could come to see him as a much-needed ally, fearing a repeat of the landslide victory in the 2000 elections by reformists committed to transforming the Islamic republic into a Western-style democracy.

Conservative lawmaker Gholam Ali Haddad Adel, whose daughter is married to Khamenei's son, said the moderates are more interested in bringing back McDonald's restaurants than in countering the U.S.-backed and Saudi-led air campaign against Shiite rebels in Yemen.

"Unfortunately, some are embracing America and opening their arms to American companies," he said.

No one could accuse Ahmadinejad of being soft on America, but he was widely blamed for the economic crisis that emerged near the end of his rule after tough international sanctions were imposed in 2012.

After he stepped down the following year, even hard-line media outlets said he should be held accountable for his administration's mismanagement of the economy. The Javan newspaper called on him to apologize to Iranians on national TV, and the weekly Yalesarat said he should stand trial as a lesson to others.

But, Mehrdad Khadir, a journalist for a moderate newspaper, said Ahmadinejad and his allies could win a minority of seats in February's elections, and with Khamenei's support he could seek the presidency in 2017.

"The lower classes, who are easily attracted with simple slogans, might still like Ahmadinejad's style, even if they don't necessarily favor him in person," he said.

"If (the supreme leader) feels that Ahmadinejad's running for an election can create enthusiasm and a heated competition, he will welcome it, provided that (Ahmadinejad) is not linked to the financial scandal cases."

University professor Sadeq Zibakalam says moderates shouldn't write off the former hard-line leader. "Don't underestimate Ahmadinejad," he said.