Sri Lanka could hold an early election on January 5 after the President dissolved parliament in a bid to stave off a deepening political crisis, sparked by his dismissal of the prime minister that opponents say is unconstitutional.

Key points: The dissolution of parliament is likely to be challenged under the constitution

The dissolution of parliament is likely to be challenged under the constitution Tensions had been brewing between the two leaders for some time

Tensions had been brewing between the two leaders for some time Thousands of Sri Lankans earlier marched to protest the political crisis

The country has been in a crisis since October 26, when President Maithripala Sirisena fired his prime minister, Ranil Wickremesinghe, and replaced him with former strongman Mahinda Rajapaksa.

Mr Wickremesinghe has insisted his firing is unconstitutional, with both men claiming the prime ministership.

He has refused to vacate his official residence and demanded that Parliament — which had been suspended for almost three weeks — be summoned immediately to prove he had support among its members.

Mr Sirisena's supporters had been irked by Speaker Karu Jayasuriya's announcement that he was going to call for a vote in the 225-member house on Wednesday for either party to prove their support.

"The dissolution clearly indicates that Mr Sirisena has grossly misjudged and miscalculated the support that he might or could secure to demonstrate support in the Parliament," Bharath Gopalaswamy, director at US-based analyst group Atlantic Council's South Asia Centre, said.

"At the end of the day, he is a victim of his own homegrown crisis."

Thousands of Sri Lankans earlier marched through the streets of Colombo to demand the President take action.

Foreign Minister Sarath Amunugama said the President dissolved parliament due to the need to go to the people to find a resolution to the crisis.

Mr Amunugama said that on Wednesday "there was to be a lot of commotion and unparliamentary activities sponsored by the speaker".

"The speaker was not planning to act according to the constitution and standing orders of parliament," he said.

Sri Lanka's sacked Prime Minister Ranil Wickeremesinghe is expected to challenge the constitutionality of the move. ( AP: Eranga Jayawardena )

Mr Wickremesinghe's camp is likely to contest Mr Sirisena's move because of constitutional provisions stating a parliament can't be dissolved until four and a half years after it is elected. The current parliament was elected in August 2015.

"It's totally unconstitutional," Harsha de Silva, a member of Wickremesinghe's United National Party and a former government minister, said.

"Sirisena has relegated the constitution to toilet paper. We will fight this dictator to the end."

The party said in a Twitter message that it will meet the elections commissioner to discuss the constitutionality of Sirisena's move.

Tensions had been building between Mr Sirisena and Mr Wickremesinghe for some time, as the president did not approve of economic reforms introduced by the prime minister.

Mr Sirisena has also accused Mr Wickremesinghe and another Cabinet member of plotting to assassinate him, a charge Mr Wickremesinghe repeatedly denied.

AP