Mahinda Rajapakse (left) was sworn in as Sri Lankan Prime Minister by Maithripala Sirisena.

Highlights Maithripala Sirisena replaces Ranil Wickremesinghe with Mahinda Rajapakse

Move comes after disagreements between Sirisena and Wickremesinghe

They reportedly clashed over plans to lease a port terminal to India

Maithripala Sirisena installed Sri Lanka's controversial former strongman leader Mahinda Rajapakse as the country's new prime minister Friday, in a shock move that plunged the island into an unprecedented constitutional crisis.

Sirisena's office announced the surprise decision after the president sacked incumbent premier Ranil Wickremesinghe -- who insisted that he was still the legitimate prime minister and would fight his dismissal in court.

"I am addressing you as the prime minister of Sri Lanka," Wickremesinghe told reporters at a nationally televised press conference. "I remain as prime minister and I will function as the prime minister."

There was no immediate comment from Rajapakse, who worshipped at a Buddhist temple shortly after he was sworn in by Sirisena at his office in a ceremony broadcast by a private TV channel loyal to the ex-president.

Rajapakse ally and opposition legislator Wimal Weerawansa asked Wickremesinghe to step down and allow a smooth transition of power.

Buit Wickremesinghe said he was urging the parliament's speaker Karu Jayasuriya to convene the legislature, where his United National Party and its allies command a majority.

The speaker said he was seeking legal advice and would announce Saturday if he recognises Rajapakse as the new prime minister.

Sirisena won elections against Rajapakse in 2015 on a platform of economic reform and accountability for atrocities committed during his opponent's 10-year iron-fisted rule which saw the bloody end of Sri Lanka's brutal civil war.

Colombo was on the verge of facing economic sanctions from Western nations over Rajapakse's human rights record before his government lost office.

Sirisena's decision to appoint his former foe prime minister threatens the Indian Ocean island nation with fresh turmoil just as it was trying the emerge from the shadow of the civil war, and the legality of the move is disputed.

A constitutional amendment passed in 2015 removed the president's power to sack the prime minister.

"The appointment of Rajapakse as the prime minister is unconstitutional and illegal. This is an anti democratic coup," finance minister Mangala Samaraweera wrote on Twitter shortly after the appointment was announced.

It comes after disagreements between Sirisena and Wickremesinghe over economic policy and day-to-day administration of the government.

Simmering power struggle

In May, Sirisena asked his prime minister to end a bitter power struggle and said the coalition government had failed to deliver promised reforms.

Sirisena said the coalition should commit to a reform agenda to revive the island nation emerging from a decades-long ethnic war that claimed more than 100,000 lives.

The pair were reported to have clashed in cabinet last week over government plans to lease a container terminal to neighbouring India.

Earlier this year, Sirisena reneged on a pledge not to run for re-election, sparking tensions with Wickremesinghe who is believed to have his own presidential ambitions.

Sirisena is also believed to have been behind a failed attempt to impeach Wickremesinghe in April.

Rajapakse lost the presidency in January 2015 and the subsequent parliamentary elections in August 2015.

However, his new Sri Lanka Podujana Peramuna (SLPP) party won local council elections in February and he had been attempting to engineer a dramatic comeback ahead of presidential elections slated for 2019.

The strongman put down the decades-old Tamil Tiger separatist struggle in May 2009 through a military assault that killed up to 40,000 ethnic Tamil civilians, according to rights groups.

His regime refused to even acknowledge war-era abuses, and bitter divisions between minority Tamils and majority Sinhalese persist.

Rajapakse's hardline government was also accused of corruption and murdering political opponents. Several of Rajapakse's close family and associates face several corruption prosecutions.

Sirisena had pledged accountability for war atrocities, but has faced international criticism for being slow to deliver on justice.

International rights groups have called for the prosecution of both the military and the Tigers, who were notorious for suicide bombings and enlisting child soldiers.