COLOMBO (Reuters) - Ranil Wickremesinghe was sworn in as Sri Lanka’s prime minister on Sunday, making a remarkable comeback weeks after being ousted by President Maithripala Sirisena under controversial circumstances.

Sri Lanka's Prime Minister Ranil Wickremesinghe addresses his supporters and the party members after assuming duties in Colombo, Sri Lanka December 16, 2018. REUTERS/Stringer

Wickremesinghe’s reinstatement, which is expected to end a political crisis that began in late October when he was surprisingly sacked, is an embarrassment for the president.

Sirisena had replaced Wickremesinghe with former president Mahinda Rajapaksa following differences over policy matters and other issues. However, Rajapaksa failed to win a parliamentary majority and resigned on Saturday as a government shutdown loomed.

Sirisena had repeatedly said he would not reappoint Wickremesinghe as prime minister. But he had to change his stance to gain parliamentary approval for a temporary budget that is required by Jan. 1.

“It is a victory for Sri Lanka’s democratic institutions and the sovereignty of our citizens,” Wickremesinghe said in a tweet. “I thank everyone who stood firm in defending the constitution and ensuring the triumph of democracy.”

He later told his supporters at his official residence that he would ensure a “better economic situation, better standard of living” for Sri Lankans after first working to “normalize the country”.

The swearing-in ceremony was closed to the media and only a few lawmakers from Wickremesinghe’s coalition were present, an official in the president’s office told Reuters. The official did not want to be named.

Slideshow ( 4 images )

Wickremesinghe, who has never completed a full term as prime minister, was appointed for the post for the fifth time.

The South Asian island country’s parliament had voted to cut the budget for Rajapaksa and his ministers after Sirisena refused to accept no-confidence votes against Rajapaksa, saying that due process was not followed.

Sri Lanka’s parliamentarians have already passed a confidence vote in Wickremesinghe as they sought his return as prime minister to defuse a constitutional crisis.

On Friday, Sri Lanka’s Supreme Court rejected Rajapaksa’s bid for an injunction against a lower court’s order that barred him and his Cabinet from performing their roles.

Many foreign countries refused to recognize Rajapaksa’s government. Credit rating agencies Fitch and Standard & Poor’s downgraded Sri Lanka, citing refinancing risks and an uncertain policy outlook.

Sirisena came to power in 2015 on a pledge to uphold democracy and stamp out corruption. However, his popularity has been hit by a crisis many say he triggered because of personal differences with Wickremesinghe.

Much of the conflict between the two men centered on a dispute over how much to accommodate Indian interests in the country versus Chinese, government officials and foreign diplomats told Reuters last month.

China has been investing heavily in the country though India is the traditional power in the region.

India welcomed the resolution of the political turmoil in Sri Lanka.

“This is a reflection of the maturity demonstrated by all political forces, and also of the resilience of Sri Lankan democracy and its institutions,” said Raveesh Kumar, spokesman for India’s Ministry of External Affairs.

“India remains committed to taking forward its people-oriented development projects in Sri Lanka. We are confident that India-Sri Lanka relations will continue to move on an upward trajectory.”