The 60-year-old Raisi, who enjoys wide backing from the conservative and hardline revolutionary camp and its base, will remain chief justice until he takes over from moderate outgoing President Hassan Rouhani in early August as he did not resign from his post to run for president.
Raisi is referred to as a likely successor to the 82-year-old Khamenei when he passes away.
Before the 1979 revolution
Raisi was born in Mashhad in northeastern Iran, a major city and a religious centre for Shia Muslims as it houses the shrine of Imam Reza, the eighth imam.
Growing up in a clerical family, Raisi received a religious education and began attending the seminary in Qom when he was 15. There, he studied under several prominent scholars, including Khamenei.
When his education came up during the presidential debates, he denied that he has only six grades of classical education, saying he holds a PhD in law in addition to his seminary education.
When he entered the influential seminary in Qom just years before the 1979 revolution that brought about the Islamic Republic, many Iranians were dissatisfied with the governance of Mohammad Reza Shah Pahlavi, who was ultimately deposed.
Raisi was purportedly a participant in some of the events that forced the shah into exile and set up the new clerical establishment under Supreme Leader Ayatollah Ruhollah Khomeini.
Following the revolution, Raisi joined the prosecutor’s office in Masjed Soleyman in southwestern Iran. Over the next six years, he added to his experience as a prosecutor in several other jurisdictions.
A crucial development came when he moved to Iran’s capital, Tehran, in 1985 after being appointed deputy prosecutor.
Raisi will become the first Iranian president to have been targeted by United States sanctions, imposed in 2019, over his alleged role in the mass executions and for cracking down on public protests.
Amnesty International has called for the leader to face charges of crimes against humanity.
The leader continued to rise within Iran’s judicial system following Khamenei’s accession to the supreme leadership in 1989. He later held roles as prosecutor of Tehran, then headed the General Inspection Organization, and then served as deputy chief justice for a decade until 2014, during which time the pro-democracy Green Movement protests of 2009 took place.
In 2006, while serving as deputy chief justice, he was for the first time elected from South Khorasan to the Assembly of Experts, a body that is tasked with choosing a replacement for the supreme leader in the event of his death. He still holds that role.
Raisi was promoted to attorney general of Iran in 2014 and remained in that position until 2016, when he climbed the ladder yet again – albeit outside the judicial system this time – and was appointed by the supreme leader as the custodian of the Astan-e Quds Razavi, a huge bonyad, or charitable trust, that manages the shrine of Imam Reza and all affiliated organisations.
In that position, Raisi commanded billions of dollars’ worth of assets and made ties with the religious and business elite of Mashhad, Iran’s second-largest city.
Raisi, who has two daughters, is also the son-in-law of Ahmad Alamolhoda, the hardline longtime Friday prayer leader of Mashhad, who has become known for his fiery ultraconservative speeches and highly controversial remarks and ideas.
In 2017, Raisi ran for president for the first time and became the main candidate against Rouhani, a moderate who championed engagement with the West and Iran’s 2015 nuclear deal with world powers that lifted multilateral sanctions in exchange for curbs on the country’s nuclear programme.
Raisi and his ally Mohammad Bagher Ghalibaf, who in 2020 became the speaker of a new hardline parliament amid low turnout and wide disqualification of reformist candidates, lost the election to Rouhani. Raisi did, however, garner just less than 16 million votes or 38 percent in an election with a 73 percent turnout.
After a short retreat, the supreme leader in 2019 appointed him as the chief justice.
In that position, the leader tried to cement his image as a staunch opponent of corruption. He held public trials and prosecuted figures close to the government and the judiciary.
He also effectively kickstarted his presidential campaign and travelled to almost all of Iran’s 32 provinces. In those visits, he would often announce he had brought a big factory back from the brink of bankruptcy, portraying himself as a champion of hard-working Iranians and boosting local businesses under US sanctions.
Raisi carried that theme into his 2021 campaign, in which he made limited promises as it was evident none of the other candidates could mount a serious challenge to his presidency amid a bad economic situation, low turnout and wide disqualification of reformist and moderate candidates.
During his time at the judiciary, messaging app Signal was banned earlier this year after a surge in popularity, as was the voice chat app Clubhouse when it became massively popular in the run-up to the elections.
All major social media and messaging apps are blocked in Iran, with the exception of Instagram and WhatsApp.
When pressed by another candidate, Raisi briefly discussed the Joint Comprehensive Plan of Action (JCPOA), as the nuclear deal that former US President Donald Trump unilaterally abandoned in 2018 is formally known.
While he had previously opposed the deal, this time he said he would support it as any other state commitment, but will form a “strong” government that will be able to steer it in the right direction.
A sixth round of talks between Iran and world powers is ongoing in Vienna to restore the accord, that, if successful, will lead to lifting US sanctions and scaling down Iran’s nuclear programme as the country is now enriching uranium up to 63 percent, its highest ever rate.
Even as the June 24 deadline of a temporary agreement with the International Atomic Energy Organization to keep monitoring activities in Iran in place approaches, negotiators have said the sixth round will not be the final round. But there are hopes the agreement could be revived before Raisi assumes office.
Meanwhile, the 83-million-strong population of Iran is suffering from rampant inflation and high unemployment while the government is running a considerable budget deficit and faces difficulties in handling what has become the deadliest COVID-19 pandemic of the Middle East.
Raisi has promised to tackle inflation, create at least one million jobs per year, build new housing and dedicate special loans to first-time homebuyers who get married, in addition to ushering in a new era of financial transparency and fighting corruption.
Hamed Mousavi, a political science professor at Tehran University, said the narrative among conservatives has been that mismanagement by the Rouhani government led to the current situation.
“So according to this narrative, if this mismanagement is fixed then the economy will be fixed but I do think that many conservatives at least internally understand how important the sanctions are,” he told Al Jazeera.
“I think this will go back to how much Raisi will show flexibility in the negotiations. One important point is who will he appoint for the nuclear negations.”
One choice is hardliner Saeed Jalili, a former nuclear negotiator under President Mahmoud Ahmadinejad who was one of seven approved candidates in the 2021 race and withdrew in favour of Raisi.
According to Natasha Lindstaedt, a researcher at the University of Essex, the likely effects of Raisi’s election on ties with the US are uncertain.
“But the type of rhetoric that the Iranian president can issue sometimes affects the way the US responds,” she told Al Jazeera.
“I see Raisi in some way as the return to Ahmadinejad, a more populist, authoritarian president and that was a period when the relationships with the US and Iran was really tense,” she said.