Six-time prime minister Ranil Wickremesinghe was elected as crisis-wrackedÂ Sri Lanka's new president by the country's parliament on Wednesday, with the backing of the party of the ex-leader -- who fled abroad after his palace was stormed by protesters.
Official results showed Wickremesinghe polled 134 votes in a three-cornered parliamentary vote, with his main opponent Dullas Alahapperuma getting 82 and leftist Anura Dissanayake just three, giving him an absolute majority on first preferences.
"Our divisions are now over," Wickremesinghe said in a brief acceptance speech in parliament, inviting Alahapperuma "to join me and work together to bring the country out of the crisis we are facing".
He said he hoped to be sworn in later Wednesday at a simple ceremony within the tightly guarded parliament building.
The 73-year-old takes charge of a bankrupt nation that is in bailout talks with the IMF, with its 22 million people enduring severe shortages of food, fuel and medicine.
But he is despised by the protesters who forced his predecessor Gotabaya Rajapaksa from his palace after months of demonstrations over an unprecedented economic crisis as an ally of the former leader.
The Rajapaksas'Â Sri LankaÂ Podujana Peramuna (SLPP) party, the largest in parliament, backed Wickremesinghe for the presidency.
Wickremesinghe has pledged to crack down hard if protesters take to the streets and hundreds of heavily armed troops and police stood guard outside the parliament, but there were no signs of demonstrators.
As acting president, Wickremesinghe extended a state of emergency that gives police and security forces sweeping powers, and last week ordered troops to evict protesters from state buildings they had occupied.
Opposition MP Dharmalingam Sithadthan said ahead of the vote that Wickremesinghe's hardline stance against demonstrators had gone down well with MPs who had been at the receiving end of mob violence, describing him as the "law-and-order candidate".
Wickremesinghe automatically became acting president when Rajapaksa resigned and political analyst Kusal Perera said he had "regained the acceptance of the urban middle classes by restoring some of the supplies like gas and he has already cleared government buildings showing his firmness".
But he appears to be indebted to the Rajapaksas, a clan of four brothers who have dominatedÂ Sri Lankan politics for much of the last two decades, for his victory.
Gotabaya's departure wounded the group after two of his brothers also quit their posts as premier and finance minister earlier this year.
But former president Mahinda Rajapaksa, the deposed Gotabaya's elder brother and the head of the family, remained in the country, and party sources said he had pressed SLPP legislators to support Wickremesinghe.
Wickremesinghe is expected to name public administration minister Dinesh Gunawardena, 73, his schoolmate and a strong Rajapaksa loyalist, as the new prime minister.
Outside the presidential secretariat, where protesters camped for months to demand Rajapaksa step down, civil enginer Nuzly Hameem said he was "disappointed" by the result.
"We expected more from our parliamentarians," he told AFP.
The protests would "obviously" continue, he said, but added "We are burnt out. It's been four months."
One by one, the legislators entered ballot booths set up on the floor of the chamber to choose between the three candidates.
Previous elections have been marred by allegations of corruption and vote-buying.
Wickremesinghe's main opponent in the vote was SLPP dissident and former education minister Alahapperuma, a former journalist who was supported by the opposition.
The third candidate was Anura Dissanayake, 53, leader of the leftist People's Liberation Front (JVP), whose coalition has three parliamentary seats.
Lawmakers in 225-member house ranked candidates in order of preference, with more than half the vote needed for victory -- a mark Wickremesinghe crossed on first preferences.
He is elected for the balance of Rajapaksa's term, which runs until November 2024.