Sri Lankas's Prime Minister Mahinda Rajapaksa has signed a resignation letter seven weeks after President Maithripala Sirisena controversially appointed him.

Key points: Sri Lanka's President Maithripala Sirisena unilaterally installed the PM in October

Sri Lanka's President Maithripala Sirisena unilaterally installed the PM in October Mr Rajapaksa wasn't able to establish authority after parliamentary and judicial vetos

Mr Rajapaksa wasn't able to establish authority after parliamentary and judicial vetos His resignation is designed to remove the gridlock that froze 2019 budget plans

Mr Rajapaksa signed the letter flanked by lawmakers of his party and blessed by Buddhist and other religious leaders in the presence of media.

Pro-Rajapaksa MP, Lakshman Yapa Abeywardena, told reporters that Mr Rajapaksa decided on Friday in a meeting with President Maithripala Sirisena to resign to allow the president to appoint a new government.

Sri Lanka has had no functioning government for nearly two weeks and is facing the prospect of being unable to pass a budget for next year.

"Unless the prime minister resigns, another prime minister cannot be appointed," Mr Abeywardena said.

"A country cannot function without a budget.

"Therefore Mr Rajapaksa says that he will make a special statement tomorrow and resign from the position of prime minister."

The decision appears to have been hastened by a Supreme Court decision to extend a lower court's suspension of Mr Rajapaksa and his Cabinet.

The top court put off the next hearing until mid-January, when it plans to rule on whether they should hold office after losing two no-confidence votes in parliament.

Ex-PM's sacking stoked simmering tensions

The President's decision to sack Prime Minister Ranil Wickremesinghe was met by sizeable protests in Colombo. ( Reuters: Dinuka Liyanawatte )

Sri Lanka runs the risk of being unable to use state funds from the first of January if there is no government to approve the budget.

It also has a foreign debt repayment of $1 billion due in early January and it is unclear if it can be serviced without a lawful finance minister.

The country has been in political crisis since October, when President Sirisena abruptly sacked then Prime Minister Ranil Wickremesinghe and replaced him with Mr Rajapaksa.

Mr Rajapaksa is a former strongman president who is considered by some as a war hero for defeating the Tamil Tiger rebels in 2009 after a long civil war.

Mr Sirisena had opposed then-Prime Minister Wickremesinghe's efforts to investigate alleged military abuses in the final days of the war.

Mr Rajapaksa lost a 2015 re-election bid amid allegations of wartime atrocities, corruption and nepotism.

The road to resignation

Sri Lanka's ousted Prime Minister Ranil Wickremesinghe, centre, labelled the President's unilateral actions unconstitutional. ( Reuters: Dinuka Liyanawatte )

The conflict began when the President sacked Prime Minister Ranil Wickremesinghe and appointed Mr Rajapaksa in his place.

Mr Wickremesinghe said that President Sirisena did not follow the constitution in removing him and claimed to still be the lawful prime minister.

Mr Rajapaksa sought to secure a majority in the 225-member parliament but failed.

In response, Mr Sirisena dissolved Parliament and ordered new elections, but those actions were put on hold by the Supreme Court until it heard the case and delivered its judgment on Thursday.

After the court suspended the dissolution, Parliament reconvened and passed two no-confidence votes against Mr Rajapaksa, but he held on to office with Mr Sirisena's backing.

Parliament also voted to block supply for him and his cabinet.

MPs opposing Mr Rajapaksa took the fight to the Court of Appeal, which suspended Mr Rajapaksa and his cabinet from functioning in their positions until it concludes the case.

Mr Rajapaksa asked the Supreme Court to end the suspension, but it rejected the request on Friday.

Mr Sirisena has repeatedly rejected appeals to reappoint the deposed prime minister, but may now be compelled to do so since Mr Wickremesinghe has the support of 117 MPs.

AP/Reuters