Image copyright AFP Image caption Opponents of Mahinda Rajapaksa had gathered outside the court ahead of the verdict

Sri Lanka's Supreme Court has suspended the president's move to dissolve parliament, as a political crisis in the island nation deepens.

President Maithripala Sirisena shocked the nation by sacking parliament and calling snap elections on Friday.

The dramatic decision came two weeks after Mr Sirisena fired his prime minister and replaced him with the country's former leader.

But his actions have been called unconstitutional.

Ranil Wickremesinghe, the ousted PM, had refused to give way to his named successor, Mahinda Rajapaksa, and had called for MPs to vote on who they believed was the rightful premier.

Correspondents said the president and Mr Rajapaksa decided to called the snap election because they did not have enough support in parliament for their new government.

Mr Wickremesinghe's United National Party (UNP) said the move was illegal and it and other parties filed petitions with the Supreme Court.

Its order means that elections, announced for 5 January, have been put on hold.

Hundreds of heavily-armed police had been deployed to the court ahead of Tuesday's decision and UNP supporters set off firecrackers in celebration as news of the order filtered out.

"The people have won their first victory. Let's go forward and re-establish the sovereignty of the people in our beloved country," tweeted Mr Wickremesinghe.

Namal Rajapaksa, an MP and son of Mahinda Rajapaksa, responded by saying the court had not made a "final decision".

What's the background?

Mr Sirisena, the president, and Mr Wickremesinghe, the sacked prime minister, joined forces in the 2015 election to defeat the then long-time president, Mr Rajapaksa.

But their uneasy coalition has since fractured and on 26 October Mr Sirisena announced he was sacking the PM and replacing him with Mr Rajapaksa.

The pair had reportedly clashed in cabinet recently over government plans to lease a port to India.

Image copyright EPA Image caption Mr Wickremesinghe has refused to leave office after his sacking

The sacking left the country with two people claiming to run the government, and Mr Wickremesinghe refused to leave his residence, Temple Trees.

President Sirisena had agreed to convene parliament on 14 November but then dramatically reversed course last Friday, when he said he was dissolving parliament.

It's unclear if parliament will now convene on Wednesday as originally planned but senior UNP officials have told the BBC that its MPs will show up.

Who is Rajapaksa?

Mahinda Rajapaksa is a popular but controversial figure. As president, he ended the decades-long civil war in 2009, but faced criticism for the means by which he achieved victory - many thousands of Tamil civilians are thought to have been killed by government forces in the final months of the fighting.

The military has always denied this, but it has remained a bitterly contentious issue and been the subject of intense scrutiny.

Image copyright Getty Images Image caption Mr Rajapaksa has been accused of massive corruption and atrocities during the country's civil war

Mr Rajapaksa also signed several large infrastructural deals with China when he was in office - saddling Sri Lanka with billions of dollars in debt. The former president and his inner circle are also accused of corruption, which they deny.