Ending the power tussle in Sri Lanka, Mahinda Rajapaksa, who was appointed as Prime Minister by President Maithripala Sirisena in a controversial move, resigned on Saturday and Ranil Wickremesinghe is likely to take oath as the island nation's Premier on Sunday.
Rajapaksa resigned after two crucial Supreme Court decisions made the embattled former strongman's efforts to cling to premiership untenable.
Pro-Rajapaksa lawmaker Shehan Semasinghe told reporters that the former President signed his resignation letter in a ceremony held in his house in Wijerama in Colombo.
"Rajapaksa informed the lawmakers of United People's Freedom Alliance (UPFA) that he has resigned from the post," MP Semasinghe said.
Rajapaksa was appointed as Prime Minister on October 26 by President Sirisena in a controversial move after sacking Wickremesinghe, which plunged the country into an unprecedented constitutional crisis.
The Supreme Court on Thursday unanimously declared that the dissolution of Parliament by Sirisena was "illegal".
The apex court on Friday refused to stay a court order restraining Rajapaksa, 73, from holding the office of Prime Minister until it fully heard the case next month.
Wickremesinghe's United National Party (UNP) on Saturday said that Sirisena has agreed to reinstate him in the post after a discussion with him over the phone on Friday.
"We have heard from the presidential secretariat that our leader will be sworn in as the Prime Minister tomorrow morning," UNP general secretary Akila Viraj Kariyawasam said.
The unprecedented political and constitutional stand off which began on October 26 with the sacking of Wickremesinghe appears to end tomorrow with his reinstatement.
Parliamentarian Lakshman Yapa Abeywardena on Friday said Rajapaksa, who had ruled Sri Lanka for nearly a decade, decided to step down "in the best interest of the country".
He claimed Rajapaksa can hold office without resigning but that will only further drag the political turmoil in the country. So the former president decided to step down after the court ruling given on Friday and on Thursday.
The Supreme Court on Friday decided that a Court of Appeal order issued against the appointment of Rajapaksa as Prime Minister and against his Cabinet from holding office will stand. The appeal filed by Rajapaksa will be taken up for hearing on January 16, 17 and 18.
The apex court asked all parties to provide written submissions within three weeks.
According to media reports, a new Cabinet will be sworn in on Monday. The Cabinet will consist of 30 members and include six Sri Lanka Freedom Party (SLFP) parliamentarians.
After his appointment as prime minister, Rajapaksa had sought to secure a majority in the 225-member Parliament but failed. Sirisena then dissolved Parliament and called snap elections on January 5.
However, the Supreme Court overturned his decision and halted the preparations for snap polls.
Most of the countries had not recognised Rajapaksa's government. The global credit rating agencies - the Fitch, the Standard & Poor's and the Moody's - had also downgraded Sri Lanka's rating owing to the current political crisis.