Image copyright AFP Image caption Mr Sirisena's opponents say his move is illegal

President Maithripala Sirisena has moved to dissolve parliament amid a political crisis following his attempt to replace Sri Lanka's prime minister.

The official notification, which took effect at midnight on Friday (17:30 GMT), would trigger a general election on 5 January.

However, it could be challenged in the Supreme Court.

The sacked prime minister's party says the president does not have the power to take such action.

Last month, President Sirisena named former strongman leader Mahinda Rajapaksa as the new prime minister after sacking Prime Minister Ranil Wickremesinghe and his cabinet and suspending parliament.

But Mr Wickremesinghe has refused to leave, saying his sacking was illegitimate.

An MP from Mr Wickremesinghe's United National Party (UNP) said the move to dissolve parliament was "illegal" and said he believed it would be rejected.

"We are requesting the election commission to solve this issue peacefully without creating a bloodbath in the country," Ajith Perera told the BBC.

BBC Sinhala's Azzam Ameen says the Sirisena-Rajapaksa camp are calling a snap election because they did not have enough support in parliament for their new government.

The UNP meanwhile would prefer a parliamentary vote to a national election at this time, our correspondent says.

What has led to this?

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 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. The ousted PM has refused to leave his residence, Temple Trees, arguing that the president's move is unconstitutional and calling for parliament to be convened quickly so a vote can take place.

Meanwhile, Mr Rajapaksa has sworn in a new cabinet and has also taken the post of finance minister. Four MPs aligned with Mr Wickremesinghe were given ministerial portfolios in a bid to win their support in parliament.

The crisis led to violence last month, when the bodyguard of the sacked oil minister fired at a crowd of protesters outside his office.

Regional rivals are watching events closely - China has congratulated Mr Rajapaksa, while India, the EU and US have called for the constitution to be respected.

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.

Many in Sri Lanka are now worried about the fate of corruption cases targeting members of the Rajapaksa family, along with investigations into the murders of journalists and others under Mahinda Rajapaksa's 2005-2015 presidency, correspondents say.