COLOMBO (Reuters) - Sri Lanka’s embattled Prime Minister Mahinda Rajapaksa resigned on Saturday, only a month and a half after taking office and giving the country’s president political space to prevent an imminent government shutdown.

Slideshow ( 4 images )

The South Asian island has been in political limbo since President Maithripala Sirisena in late October replaced former Prime Minister Ranil Wickremesinghe with Rajapaksa, who was then twice sacked by parliament but had refused to resign.

But as a government shutdown loomed, Rajapaksa put in his papers and said in a statement on Saturday that a change of government that “the people expected” has now been put off.

“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 in the statement.

He emphasized the need for an election to resolve the county’s economic and political crisis and said the main challenge now was to form a government. He also spoke against what he described as the “destructive forces” of people seeking to restore their former offices.

“We will bring the forces opposed to the country down to their knees by organizing the people,” Rajapaksa said.

Representatives of Sirisena and Wickremesinghe could not immediately be contacted.

Wickremesinghe’s office on Friday said that Sirisena had called the former prime minister by telephone to invite him to be sworn back into office on Sunday. Sirisena had previously said he would not appoint Wickremesinghe “even if he has the backing of all 225 lawmakers in parliament”.

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

It remains unclear how Sirisena plans to end the political crisis that threatens to shut down the government on Jan. 1, by which time a temporary budget must be approved by parliament.

The country’s Supreme Court on Friday rejected Rajapaksa’s bid for an injunction on a lower court’s order that barred him and his cabinet from carrying out their roles in government.

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

Earlier this week, the island nation’s parliament passed a vote of confidence in favor of Wickremesinghe, as it sought his reinstatement as prime minister by the president to defuse the political crisis.