In early 2024, the president of a university in Budapest, Hungary, received a surprising request from a senior Hungarian government official.

The official told the university president, Professor Gergely Deli, that Ludovika University of Public Service was to organize a conference on climate change and extend an invitation to an unexpected guest: Mahmoud Ahmadinejad, the widely reviled former Iranian president.

The reason was even more startling. The official told Deli that the conference was merely a cover to allow Ahmadinejad to hold secret talks in Budapest with Israeli intelligence operatives, his declared enemy.

Deli knew that the invitation could harm both his reputation and the university's. But he said in an interview that he believed he might play a role in saving lives.

He said: 'You have two enemies, and if these two enemies want to talk to each other, it's better to do what you can to make them talk.'

According to American and Iranian officials familiar with the operation, who spoke on condition of anonymity due to the sensitivity of intelligence information, Ahmadinejad's visit to the university in 2024, and his second visit the following year, were part of a years-long Israeli effort to groom him as an intelligence asset who could, when the time came, be installed as Iran's new leader.

Former American officials said that recruiting Ahmadinejad was such a high priority for Israel that the then-head of Israeli intelligence, David Barnea, traveled himself to the Hungarian capital in 2024 to meet Ahmadinejad. They added that Mossad, Israel's foreign intelligence agency, shortly afterwards informed the U.S. Central Intelligence Agency (CIA) that it had been in contact with Ahmadinejad.

Image published by the website 'Dolat-e Bahar,' the spokesman for the office of former President Mahmoud Ahmadinejad, showing his participation in the funeral of former Supreme Leader Ali Khamenei in Tehran on Monday.

Israel's decision to build a regime change plan centered on Ahmadinejad marks an extraordinary shift in its relationship with the former Iranian president, who was known for accelerating Iran's nuclear program, repeatedly calling for the destruction of Israel, and denying the Holocaust.

According to American officials, Israel in recent years secretly paid Ahmadinejad money to cover housing and travel expenses, and Israeli operatives met with him abroad on several occasions, including during his trips to Budapest.

This effort culminated in late February of this year, during the early days of the U.S.-Israeli war on Iran, in a daring operation to move the former leader, who was under heavy surveillance in Tehran. The goal was to launch the plan to overthrow the current regime and install Ahmadinejad. But the plan failed.

On February 28, an Israeli airstrike hit Ahmadinejad's compound, targeting his personal guards' building and his armored vehicle. After the strike, according to four senior Iranian officials, a black Peugeot arrived, picked up Ahmadinejad, and sped away from the chaotic scene.

American and Iranian officials familiar with the operation said the car was driven by Mossad operatives, who transported Ahmadinejad to a secret safe house inside Iran.

But the former Iranian president was upset by the frantic rescue operation and appeared disillusioned with the Israeli plan to return him to power, according to people familiar with the matter.

He later left the safe house under circumstances that remain unclear. Ahmadinejad did not appear in public again until July 6, when he briefly participated in the funeral procession of the late Iranian Supreme Leader Ali Khamenei.

His current status remains uncertain. But four senior Iranian officials said Ahmadinejad is being held by the intelligence arm of the Revolutionary Guards and is currently under house arrest after Iran learned many details of his contacts with Israel.

Israeli officials have not publicly commented on the plan to install Ahmadinejad as Iran's leader, which was part of a broader attempt to topple the government in Tehran. Another element of the plan involved arming and training Iranian Kurdish opposition forces based in northern Iraq to cross the border into western Iran, seize territory there, and eventually advance toward Tehran—a plan that never materialized.

Tamir Hayman, former head of Israeli military intelligence, said during the PBS program 'Firing Line' in May, after the New York Times first revealed details of Ahmadinejad's role in the plan: 'The regime change plan included a series of special operations, very, very unique, that were supposed to be executed.' He added: 'And Ahmadinejad was part of that series.'

Mossad officials did not respond to requests for comment. Ali Akbar Javanfekr, Ahmadinejad's spokesman, also declined to comment.

Shift after the presidency

As president of Iran from 2005 to 2013, Ahmadinejad was the country's most prominent hardline politician. He called for the elimination of Israel, and under his watch Iran resumed its uranium enrichment program, raising suspicions that it was pursuing a secret nuclear weapons program. He also ordered a violent crackdown on the nationwide uprising protesting his 2009 re-election, and his tenure saw the judiciary carry out mass executions of opponents and the imprisonment of rivals and foes.

Ahmadinejad waves his hands as he arrives at the headquarters of the presidential election candidate registration committee at the Interior Ministry in June 2024 (Archive - E.P.A.)

But in the years after leaving the presidency, Ahmadinejad moderated his positions and toned down the anti-Israel rhetoric that had marked his rule. He was keen to project a new, more moderate image by giving interviews and speeches touching on Iranian pop music culture, criticizing security forces for violent crackdowns, and accusing the ruling class of financial corruption.

He also abandoned his signature loose-fitting khaki jacket and began wearing tailored suits. He groomed his unkempt beard, appeared to have undergone Botox treatments, and started learning English.

In his office in Tehran, he held daily hour-long public meetings to listen to complaints from ordinary citizens, some of whom sought his help dealing with government bureaucracy. Occasionally, he wrote letters to ministries recommending that some petitioners be granted loans. He also traveled regularly across the country, meeting supporters in cities and rural areas.

Ahmadinejad speaks to his ally Saeed Jalili, advisor to Iran's Supreme Leader, on the sidelines of the opening ceremony of the Assembly of Experts in Tehran (Archive - ILNA)

Ahmadinejad's relationship with the Iranian government was complicated. Senior leaders marginalized him and imposed restrictions on his movements, but they allowed him to sit alongside other senior officials on a high-level council that advises Iran's Supreme Leader. He attended a meeting of that council in February, just days before the war broke out.