2022 Sri Lankan presidential election

An indirect presidential election was held in the Parliament of Sri Lanka on 20 July 2022 following the resignation of president Gotabaya Rajapaksa on 14 July. The president of Sri Lanka was elected by the Parliament of Sri Lanka in a secret ballot to decide who would complete the remainder of Gotabaya Rajapaksa's term. Candidates were nominated in the Parliament on 19 July in advance of the election the following day.

Ranil Wickremesinghe won the election with 134 votes and was elected as the ninth President (eighth executive President) of Sri Lanka. The election, which was held amid a political crisis, was the first time in the history of Sri Lanka that a vote took place in Parliament to elect a President.

Procedure
According to the Presidential Elections (Special Provisions) Act of 1981, "Where the office of President becomes vacant in terms of paragraph (1) of Article 38 of the Constitution, as provided by Article 40 of the Constitution, Parliament shall elect as President one of its members who is qualified to be elected to the office of President, to hold office for the unexpired period of the term of office of the President vacating office." Hence, following the resignation of Gotabaya Rajapaksa on 14 July, Parliament was charged with electing a replacement who would serve the remainder of Rajapaksa's term, which was supposed to end in November 2024. The process was led by the Secretary General of Parliament. The Speaker of the Parliament also had a vote in the election. The vote was held through a secret ballot.

Nominations
On 19 July, nominations for the presidency was called for in Parliament. Sri Lanka Podujana Peramuna Leader Dinesh Gunawardena nominated Ranil Wickremesinghe and Minister Manusha Nanayakkara seconded it. MP Vijitha Herath nominated Anura Kumara Dissanayake, seconded by MP Harini Amarasuriya. Opposition Leader Sajith Premadasa nominated Dullas Alahapperuma's name which was seconded by SLPP Chairman G. L. Peiris. The Secretary General of Parliament Dhammika Dasanayake announced the names of the nominees for president.

Voting
Parliament met at 10:00 (SLST) on 20 July to elect the president through a secret ballot. Each MP is entitled to only one vote and the vote should be marked with the number "1" in the box in front of the candidate's name with an option to mark preferences when there are multiple candidates.

After voting, the number of votes recorded for each candidate is counted. If a candidate receives more than half of the valid votes cast, the returning officer, i.e. the Secretary General of the Parliament, immediately announces that the candidate has been elected to the presidency. If no candidate gets more than half of the valid votes cast, the candidate with the lowest number of votes is eliminated from the competition. If each MP who voted as first preference for the candidate removed from the competition has their second preference, they will be added to the respective candidate. Even if no candidate has received more than half of the valid votes, the candidate who received the fewest votes in each calculation is removed from the competition, and votes are added to the remaining candidates in the second, third, etc. Even after doing so, if no candidate has obtained half of the valid number of votes, the election officer will declare that the candidate who obtained the majority of votes at the end of the counting as above has been elected to the office of President. Also, when the votes are equal between two or more candidates, a draw will be made at the sole discretion of the Returning Officer.

Election schedule
According to the Presidential Elections (Special Provisions) Act of 1981, "Where the office of President becomes vacant in terms of paragraph (1) of Article 38 of the Constitution, as provided by Article 40 of the Constitution, Parliament shall elect as President one of its members who is qualified to be elected to the office of President, to hold office for the unexpired period of the term of office of the President vacating office." The constitution requires for a successor to be elected within 30 days.

Declined

 * Maithripala Sirisena, (SLFP), MP from Polonnaruwa, former President of Sri Lanka (2015–2019)

Not nominated

 * Mahinda Yapa Abeywardena, (SLPP), Speaker of the Parliament of Sri Lanka (2020–present), MP from Matara (2001–present)
 * Sarath Fonseka, (SJB), MP from the Gampaha (2020–present)
 * M. A. Sumanthiran, (ITAK), MP from Jaffna (2015–present)

Conduct
On 18 July, the Speaker of the Parliament requested police to conduct investigations on those who publish posts on social media networks threatening and exerting pressure to MPs regarding the voting in the presidential election, and Police Headquarters gave instructions to the Computer Crimes Investigation Division to enforce the law against such people.

After media reporting that some political parties have asked their MPs to take a photo of their ballot papers to check if they defied the party line, speaker and the secretary-general of the Parliament warned parliamentarians not to show their ballot papers to anybody else. The MPs were also barred from bringing their mobile phones to the ballot box. It was further informed that any moves to force an MP to photograph their ballot will result in them being banned from sitting in Parliament for seven years.

Aftermath
Wickremesinghe was sworn in as the eight executive President of Sri Lanka in the Parliament before Chief Justice Jayantha Jayasuriya. After Wickremesinghe was declared the winner, it was widely expected that the 2022 Sri Lankan protests would resume, as protestors had been demanding his resignation as Prime Minister.

The day after his victory, Wickremesinghe appointed SLPFA MP Dinesh Gunawardena as Prime Minister. Gunawardena and Wickremesinghe were classmates during school days.

On 22 July, Chinese President Xi Jinping congratulated Wickremesinghe on his election, stating that the country would "surely overcome temporary difficulties and push forward the process of economic and social recovery" under his leadership.