BIRJAND, Iran - When many struggling families in this eastern Iranian city take stock of departing President Mahmoud Ahmadinejad's legacy, it's not about the oratory full of bluster and menace or his tussles with Iran's ruling clerics that are known to much of the world.

What matters more here are the dusty rows of government-subsidized, two-story apartment buildings on the outskirts of the once-neglected outpost - testament to an effective populist outreach that has won the president millions of loyal backers in the provinces.

That support could give him influence beyond next month's election to pick his successor, underscoring how public opinion is relevant in Iran despite the heavy hand of clerical rule.

At first glance, Ahmadinejad may appear as a mostly spent political force. Damaging internal battles with the Islamic establishment over power and policies have left him so politically toxic in ruling circles that the possible leading candidates to replace him have all joined to ridicule his presidency.

Counting Ahmadinejad out grossly underestimates his most critical asset: a deep well of grateful and loyal supporters in hardscrabble places such as Birjand, a city of nearly 300,000 in windswept hills near the border with Afghanistan.

"May God bless Ahmadinejad," said Birjand taxi driver Ali Reza Farsi. "He is my hero."

While Iran's theocracy holds many levers in the election, including vetting all candidates and deciding who appears on the final ballot, public opinion remains a legitimate force in Iran. It gave pro-reform President Mohammad Khatami a landslide reelection in 2001 and unleashed its fury after claims that vote fraud brought Ahmadinejad back for a second term four years ago.

Now, it's Ahmadinejad's backers who could rattle the system. No previous Iranian president has left office on such bad terms with the ruling clerics. A cozy landing for the 56-year-old leader in the inner circle or as an elder statesman is highly unlikely. This leaves Ahmadinejad with his big political ego and his still-significant political base.

"There is no doubt that an Ahmadinejad loyalist is a tough challenger no matter what," said prominent political analyst Saeed Leilaz.

His main goal has been to get his chief adviser, Esfandiar Rahim Mashaei, on the June 14 ballot. But the chances that his protégé, whose daughter is married to Ahmadinejad's son, would be approved are sharply dimmed because of his messy power struggles with the clerics.

The relationship worsened in 2011 with a dispute over the choice of intelligence minister. The atmosphere became so divisive that Ahmadinejad boycotted government meetings for 11 days to protest being overruled by Supreme Leader Ayatollah Ali Khamenei, who has the final say in all critical affairs.

Even without Mashaei on the ballot, Ahmadinejad has clout in other ways stemming from his policies funneling money and public works to long-neglected areas.

He could suddenly be transformed from scorned to courted by the front-runners, including a former nuclear negotiator, a top adviser for Khamenei and the mayor of Tehran, if they decide an endorsement from Ahmadinejad could bring in a potential voter windfall in the provinces

Or he could break away and start his own political movement, which could quickly become a serious force. Ahmadinejad cannot run this year because of term limits, but a comeback bid is possible as early as 2017.

The five-day registration period for candidates closes Saturday. The election overseers, known as the Guardian Council, will announce the handful of candidates on the ballot later this month.