Sri Lanka's ousted Prime Minister Ranil Wickremesinghe has been sworn into office again, two months after being removed by the president.
Mr Wickremesinghe's supporters set off fire crackers as the ceremony took place behind closed doors.
His surprise sacking by President Maithripala Sirisena plunged Sri Lanka into a political crisis.
Mr Wickremesinghe was replaced by a former president and ally of Mr Sirisena, Mahinda Rajapaksa.
But Mr Rajapaksa was unable to command a parliamentary majority and resigned on Saturday.
Journalists were not allowed to attend Sunday's swearing-in ceremony in President Sirisena's office but a picture was tweeted by MP Harsha de Silva.
"We thank the citizens of the country who fought the illegal seizure of power and ensured that democracy was restored," Mr Wickremesinghe's United National Party (UNP) posted on Twitter.
Mr Wickremesinghe's spokesman said a new cabinet would be formed in the coming days.
Sri Lanka had faced a government shutdown as the power struggle took hold, with parliament failing to approve a budget for 2019.
What led to the crisis?
President Sirisena was once a party ally of Mr Rajapaksa, and served in his government.
But in 2015, he teamed up with Ranil Wickremesinghe to defeat him in an election and the pair went on to form a coalition government.
However the relationship turned sour and Mr Sirisena in October turned on Mr Wickremesinghe, sacking him in favour of Mr Rajapaksa.
Throughout the crisis, Mr Wickremesinghe always maintained he was the rightful prime minister.
On Thursday, Sri Lanka's Supreme Court ruled that President Sirisena had acted illegally in November by dissolving parliament and calling snap polls.
The crisis, which has provoked brawls in parliament and sparked large protests, has been closely watched by regional power India, as well as the US, China and the European Union.