Sri Lanka’s Parliament voted Wednesday to elect six-time Prime Minister Ranil Wickremesinghe as president after the country's previous leader fled the country amid protests over an major economic crisis. 

Following Wednesday's secret-ballot election, Wickremesinghe, 73, will succeed former President Gotabaya Rajapaksa and serve the remainder of his term, set to end in 2024. 

"I need not tell you the status our country is in," he said after winning. "Now that the election is over we have to end this division. We had 48 hours to stay divided but from now on I am ready to have a dialog with you," he added, calling for political unity.

He will now look to piece together the country’s economic and humanitarian woes that sparked the widespread protests.

SRI LANKA PRESIDENT FLEES COUNTRY, PROTESTERS STORM PRIME MINISTER'S OFFICE AS STATE OF EMERGENCY IS DECLARED

Sri Lanka's Ranil Wickremesinghe sits down for an interview with The Associated Press

FILE - Sri Lanka's Ranil Wickremesinghe gestures during an interview with The Associated Press in Colombo, Sri Lanka, Saturday, June 11, 2022.  (AP Photo/Eranga Jayawardena, File)

Secretary-General of Parliament Dhammika Dasanayake opened the parliamentary session Wednesday morning, instructing lawmakers not to publicize or take photos of their ballots.

Front-runners of the presidential race included Wickremesinghe, Dullas Alahapperuma, a former government minister and spokesman and Anura Dissanayake, a Marxist candidate.

Rajapaksa appointed Wickremesinghe as prime minister in May, hoping to bring stability to a country engulfed in its worst economic crisis in memory. Wickremesinghe became acting president after Rajapaksa fled the country last week and resigned by email.

Dullas Alahapperuma was a candidate to become Sri Lanka's next president

This undated handout photo provided by Sri Lanka's Department of Government Information shows Dullas Alahapperuma, a candidate for the presidential race, in Sri Lanka.  (Sri Lanka's Department of Government Information via AP)

SRI LANKAN PRESIDENT, PRIME MINISTER TO RESIGN AFTER PROTESTERS STORM RESIDENCES, SET FIRE

Wickremesinghe, a seasoned politician, received 134 votes despite being seen as a holdover from the controversial Rajapaksa administration, which led the country into an economic catastrophe. Protesters were seen yelling outside of the president's residence after the election.

Wickremesinghe, also the country’s finance minister, has pledged to overhaul the government and decentralize some federal powers.

CLICK HERE TO GET THE FOX NEWS APP

Alahapperuma, 63, a populist candidate and former government spokesperson, received 78 votes. Dissanayake, 53, who previously ran for the presidency in 2019, received three votes.

Protesters in Sri Lanka call for the president to resign over an economic crisis

Protesters shout slogans demanding acting president and prime minister Ranil Wickremesinghe resign in Colombo, Sri Lanka, in Colombo, Sri Lanka, Tuesday, July 19, 2022. (AP Photo/Rafiq Maqbool)

All 225 Parliamentary members were eligible to vote and the results were announced immediately. 

Presidents in Sri Lanka are normally elected by the public. The responsibility falls on Parliament only if the office of president becomes vacant before a term officially ends.

A major economic crisis in Sri Lanka has left 22 million people struggling with shortages of essentials including medicine, fuel and food while the government negotiates a bailout with the International Monetary Fund.

The Associated Press contributed to this report.