Ranil Wickremesinghe, a lawyer who served as Sri Lanka's prime minister a record six times, has finally made it to the top job, securing the presidency after winning a parliamentary vote on Wednesday despite fierce public opposition to his candidacy.
"I thank parliament for this honour," the 73-year-old said after his victory was announced by the secretary-general of the legislature. He secured 134 votes in the 225-member house, while his main rival, ruling party lawmaker Dullas Alahapperuma, got 82.
Wickremesinghe's rise to power is remarkable. He has run unsuccessfully for president twice before but secured enough votes among lawmakers despite controlling just one seat - as leader of the United National Party (UNP).
His experience in senior government positions, and a reputation as a shrewd operator, should count in his favour as he seeks a way out of Sri Lanka's devastating economic crisis.
"Our country is facing massive challenges and we have to work on a new strategy to fulfill the aspirations of the people," he said after winning the vote in parliament. "Now, everyone must come together."
Wickremesinghe has also recently negotiated with the International Monetary Fund (IMF), and enjoys a working relationship with key donor countries including India.
Whether he can quell mass protests that led to the ouster of the previous president, Gotabaya Rajapaksa, remains to be seen.
Hundreds of thousands of demonstrators took to the streets earlier this month to vent their fury at soaring inflation, shortages of fuel and other vital goods, regular power blackouts and what they see as corruption among the ruling elite.
While the focus of their ire was Rajapaksa, a member of the country's most powerful political dynasty before the crisis who fled the country for Singapore, they also demanded that Wickremesinghe stand down - something he refused to do.
Wickremesinghe's victory in parliament came after he secured the backing of many within the main party, Sri Lanka Podujana Peramuna (SLPP), that is dominated by the Rajapaksa family.
He took over as prime minister in May after the former president's elder brother, Mahinda Rajapaksa, quit from the position following clashes between pro and anti-government protesters that triggered a deadly wave of violence.
Since then, Wickremesinghe has been involved in negotiations with the IMF for a potential bailout package of up to $3 billion, besides working on an interim budget to slash government expenditure.
"This is a economic crisis and not a political crisis," the SLPP's General Secretary Sagara Kariyawasam told Reuters.
"We feel that Ranil Wickremesinghe is the only person with the experience, the know-how and the capacity to provide solutions to the economic crisis."
As president, he is to complete Rajapaksa's term that was scheduled to end in 2024.
'POLITICS IS A BLOODSPORT'
Born into a prominent family of politicians and businessmen with large interests in the media, a 29-year-old Wickremesinghe was made the country's youngest cabinet minister by his uncle, President Junius Jayewardene, in 1978.
In 1994, following assassinations that wiped out several of his senior colleagues, Wickremesinghe became leader of the UNP.
Unlike the Rajapaksas, he has little support beyond wealthy urban voters - although that hasn't stopped him from repeatedly finding a way back to the premiership.
On July 9, Wickremesinghe announced that he was willing to step down as prime minister as protesters swarmed through central Colombo and set a part of his personal residence ablaze.
An economic liberal who has experience of dealing with the IMF from his previous tenure, Wickremesinghe has also built relationships with China and India, the Asian giants that have long jostled for influence over the Indian Ocean island.
Critics blame him for stalling multiple investigations against the Rajapaksa family, including on human rights and corruption allegations - an accusation he has denied.
Wickremesinghe's refusal to relinquish party leadership led to the formation of the Samagi Jana Balawegaya (SJB), whose leader Sajith Premadasa was also a presidential contender.
As parliament met to finalise nominees for the post on Tuesday, Premadasa abruptly dropped out of the race and announced he would support Alahapperuma. Ultimately it was not enough to sway the vote.
"Politics is more than chess," Wickremesinghe said in a television interview in 2014.
"It's teamwork like cricket. It is how you must have the stamina for a marathon. It's a hard game like rugger and it is a bloodsport like boxing."
(Editing by Mike Collett-White and Raju Gopalakrishnan)