Sri Lanka’s prime minister has resigned, saying he wanted to end a long political crisis over his appointment and allow the president to form a new government.

Mahinda Rajapaksa signed a letter of resignation in the presence of the media, flanked by MPs from his party and blessed by Buddhist and other religious leaders. It was not immediately clear if the letter had been handed over to the country’s president, Maithripala Sirisena.

“Since I have no intention of remaining as prime minister without a general election being held, and in order to not hamper the president in any way, I will resign from the position of prime minister and make way for the president to form a new government,” Rajapaksa said.

He was due to deliver an address to the nation later on Saturday in which he was expected to explain his resignation.

The Guardian view on Sri Lanka: president v prime minister | Editorial Read more

Lakshman Yapa Abeywardena, an MP close to Rajapaksa, told reporters on Friday that the prime minister had decided to step down to end a crisis that began in October when Sirisena sacked his predecessor Ranil Wickremesinghe.

Sirisena then named Rajapaksa the new prime minister, but parliament has rejected the appointment twice.

Rajapaksa’s resignation comes a day after the supreme court extended a lower court’s suspension of Rajapaksa and his cabinet. It put off the next hearing until mid-January, when it plans to rule on whether they should remain in office after losing two no-confidence votes.

Sri Lanka has had no functioning government for nearly two weeks and faces the prospect of being unable to pass a budget for next year if a new government is not appointed quickly.

Sri Lanka's president calls snap election in bid to end power struggle Read more

Failure to do so could leave the country without access to state funds from 1 January. It also has a foreign debt repayment of $1bn due in early January, and it is unclear if it can be serviced without a lawful finance minister.

Rajapaksa is a former authoritarian president who is considered as a war hero by some for defeating the Tamil Tiger rebels in 2009 after a long civil war. He lost a 2015 re-election bid after facing allegations of wartime atrocities, corruption and nepotism.

After his appointment as prime minister, he sought to secure a majority in the 225-member parliament but failed to do so. Sirisena then dissolved parliament and called new elections, but the supreme court struck down the move as unconstitutional.