Sri Lanka’s president has reappointed Ranil Wickremesinghe as prime minister, nearly two months after firing him and setting off weeks of political stalemate.

Wickremesinghe’s United National Party (UNP) said on its official Twitter account that the deposed leader took oath before President Maithripala Sirisena on Sunday.

His reinstatement is an embarrassment for Sirisena, who had replaced him with former president Mahinda Rajapaksa in October following bitter personal differences and disagreement over policymaking.

However, Rajapaksa failed to win a parliamentary majority and resigned on Saturday as a government shutdown loomed.

Sirisena had vowed to never reappoint Wickremesinghe – who he publicly castigated in speeches in recent weeks – as prime minister under his watch.

Following his oath-taking ceremony, Wickremesinghe thanked “everyone who stood firm in defending the constitution and ensuring the triumph of democracy”.

In a Twitter post, he described his reinstatement as “a victory for Sri Lanka’s democratic institutions and the sovereignty of our citizens”.

Today marks a victory not for myself or for the UNP. It is a victory for Sri Lanka’s democratic institutions and the sovereignty of our citizens. I thank everyone who stood firm in defending the constitution and ensuring the triumph of democracy. — Ranil Wickremesinghe (@RW_UNP) December 16, 2018

Hundreds of UNP members gathered at the prime minister’s official residence to celebrate Wickremesinghe’s return to office.

Addressing his supporters, the newly appointed prime minister said: “Our first objective is to return the country to normalcy and to restart the developmental process again … We want to develop the country.”

@officialunp supporters throng TT to receive PM @RW_UNP. He thanks all of them as well as others who stood up and for sticking together these 50+ days to defeat #CoupLK @sajithpremadasa pic.twitter.com/NeOz4XFaNX — Harsha de Silva (@HarshadeSilvaMP) December 16, 2018

Setback for Sirisena

Rajapaksa’s son, Namal, a legislator, also congratulated the reinstated prime minister in a Twitter post.

“I hope at least now he will towards ensuring the sovereignty of this country and more so address issues of our people more than Western interests,” he said.

Politics aside I would like to congratulate @RW_UNP being appointed as the Prime Minister of Sri Lanka. I hope at least now he will work towards ensuring the sovereignty of this country and more so address issues of our people more than Western interests. — Namal Rajapaksa (@RajapaksaNamal) December 16, 2018

There was no immediate comment from Sirisena

The president suffered a huge setback when the highest court in the country ruled last week that he acted outside the constitution when he sacked parliament in early November.

The court also confirmed Friday that Rajapaksa and his purported cabinet could not exercise the powers of the office they held.

A spokesman for Wickremesinghe said he was expected to form a cabinet in the coming days, with priority given to the 2019 budget, without which foreign debt servicing may not be possible.

Sri Lanka had been braced for a government shutdown as parliament failed to approve spending for 2019, and ratings agencies downgraded the country’s credit rating amid fears of a sovereign debt default.

Sirisena came to power in 2015 on a pledge to uphold democracy and stamp out corruption. However, his popularity has been hit by the crisis triggered by Wickremesinghe’s sacking.

Rathindra Kuruwita contributed reporting from Colombo.