image copyrightATTA KENARE/AFP
Ebrahim Raisi, a hardline cleric close to the Supreme Leader Ayatollah Ali Khamenei, is set to become Iran's new president.
The 60-year-old presented himself as the best person to combat corruption and solve the economic problems Iran has experienced under the outgoing President Hassan Rouhani.
He is the country's top judge, and has ultra-conservative political views. Many Iranians and human rights activists have pointed to his alleged role in the mass executions of political prisoners in the 1980s.
- Iran's presidential election: Four ways it matters
image copyrightAnadolu Agencyimage captionMr Raisi (C) and President Hassan Rouhani (2nd R) greet Ayatollah Ali Khamenei at a memorial service in 2020
Ebrahim Raisi was born in 1960 in Mashhad, Iran's second biggest city and home to the country's holiest Shia shrine. His father, who was a cleric, died when he was five years old.
Mr Raisi, who wears a black turban identifying him in Shia tradition as a descendant of the Prophet Muhammad, followed his father's footsteps and started attending a Shia seminary in the holy city of Qom at the age of 15.
While a student he took part in protests against the Western-backed Shah, who was eventually toppled in 1979 in an Islamic Revolution led by Ayatollah Ruhollah Khomeini.
image copyrightGetty Imagesimage captionIran became an Islamic Republic after the 1979 revolution, with Ayatollah Khomeini as supreme leader
After the revolution he joined the judiciary and served as a prosecutor in several cities while being trained by Ayatollah Khamenei, who became Iran's president in 1981.
Mr Raisi became the deputy prosecutor in Tehran when he was only 25.
While in that position he served as one of four judges who sat on secret tribunals set up in 1988 that came to be known as the "Death Commissions".
The tribunals "re-tried" thousands of prisoners already serving jail sentences for their political activities. Most were members of the leftist opposition group Mujahedin-e Khalq (MEK), also known as the People's Mujahedin Organisation of Iran (PMOI).
image copyrightAFPimage captionMr Raisi has said the 1988 executions were justified by a fatwa from Ayatollah Khomeini
The exact number of those who were sentenced to death by the tribunals is not known, but human rights groups have said almost 4,000 men and women were executed and buried in unmarked mass graves in what constituted a crime against humanity.
Leaders of the Islamic Republic do not deny that the executions happened, but they do not discuss details and legality of the individual cases.
Mr Raisi has not publicly acknowledged his role, but he has said the executions were justified because of a fatwa, or religious ruling, by Khomeini.
Five years ago an audio tape of a 1988 meeting between Mr Raisi, several other members of the judiciary and then Deputy Supreme Leader Ayatollah Hossein Ali Montazeri was leaked. In it, Montazeri is heard describing the executions as "the biggest crime in the history of the Islamic Republic". A year later Montazeri lost his position as Khomeini's designated successor and Ayatollah Khamenei became the Supreme Leader upon Khomeini's death.
image copyrightGetty Imagesimage captionMr Raisi was custodian of the shrine of the Shia Imam Reza in Mashhad from 2016 to 2019
Mr Raisi went on to serve as Tehran's prosecutor, then head of the State Inspectorate Organisation and first deputy head of the judiciary, before being appointed prosecutor general of Iran in 2014.
Two years later, Ayatollah Khamenei named him custodian of one of Iran's most important and wealthiest religious foundations, the Astan-e Quds-e Razavi.
It manages the shrine of the eighth Shia Imam Reza in Mashhad as well as all various charities and organisations affiliated with it. According to the US, it has vast economic holdings in construction, agriculture, energy, telecommunications and financial services.
image copyrightAFPimage captionMr Raisi won almost 16 million votes in the 2017 presidential election, but lost to Hassan Rouhani
In 2017, Mr Raisi surprised observers by standing for the presidency.
Mr Rouhani, a fellow cleric, won a second term by a landslide in the election's first round, receiving 57% of the vote. Mr Raisi, who presented himself as an anti-corruption fighter but was accused by the president of doing little to tackle graft as deputy judiciary chief, came second with 38%.
The loss did not tarnish Mr Raisi's image and in 2019 Ayatollah Khamenei named him to the powerful position of head of the judiciary.
image copyrightAnadolu Agencyimage captionMr Raisi is the deputy chairman of the Assembly of Experts, which will elect the next supreme leader
The following week, he was also elected as deputy chairman of the Assembly of Experts, the 88-member clerical body responsible for electing the next Supreme Leader.
As judiciary chief, Mr Raisi implemented reforms that led to a reduction in the number of people sentenced to death and executed for drug-related offences in the country. However, Iran continued to put more people to death than any other country apart from China.
The judiciary also continued to work with the security services to crack down on dissent and to prosecute many Iranians with dual nationality or foreign permanent residency on spying charges.
image copyrightEPAimage captionMr Raisi presented himself as an anti-corruption fighter at election rallies
When Mr Raisi announced his candidacy for the 2021 presidential election, he declared that he had "come as an independent to the stage to make changes in the executive management of the country and to fight poverty, corruption, humiliation and discrimination".
Little is known about Mr Raisi's private life except that his wife, Jamileh, teaches at Shahid Beheshti University in Tehran, and that they have two children. His father-in-law is Ayatollah Ahmad Alamolhoda, the hardline Friday prayer leader in Mashhad.