COLOMBO, Sri Lanka (AP) -- Sri Lankan President Maithripala Sirisena sacked the country's prime minister and his Cabinet and replaced him with a former strongman, creating what some observers said could be a constitutional crisis in the South Asian island nation.
The prime minister, Ranil Wickremesinghe, told reporters Friday that he had no intention of leaving his post. "I have the majority. I will function as the prime minister. I will remain as the prime minister," he said.
Sirisena informed Wickremesinghe that he was being replaced by his former nemesis, Mahinda Rajapaksa, according to aide Mahinda Amaraweera.
Amaraweera, a lawmaker from Rajapaksa's party, said Rajapaksa had a majority needed in the 225-member Parliament for him to take over, but a recent constitutional amendment makes that unclear, experts said.
Constitutional lawyers, political activists and pundits debated on social media and Sri Lankan TV into early Saturday whether Wickremesinghe's ouster was legitimate.
The constitution says the president has the right to appoint someone he thinks has a majority in Parliament.
But the 19th amendment, added in 2015, says a prime minister can only be removed when he or she ceases to be a member of Parliament -- such as for failing to meet criteria to be an elector or candidate, when a vote of no-confidence is passed, or when he or she chooses to resign.
"At the moment, there is a constitutional crisis -- two persons each claiming to be the prime minister," said Jehan Perera, executive director of the nonpartisan National Peace Council of Sri Lanka.
"What the president now should do immediately is to summon Parliament and have a vote. That's the democratic way to resolve this crisis," Perera said.
Rajapaksa ruled Sri Lanka as president for nine years beginning in 2005, accumulating immense power and popularity among the country's majority ethnic Sinhalese after overseeing the military's brutal defeat of ethnic Tamil rebels in 2009, ending a 25-year civil war. Some supporters hailed him as a king and savior.
But he also was criticized for failing to allow an investigation into allegations of war crimes by the military. Under his government, dozens of journalists were killed, abducted and tortured and some fled the country fearing for their lives. He lost a bid for re-election in 2015 amid mounting allegations of corruption and nepotism.
His return to power as prime minister could signal that Sri Lanka is sliding back to an era of violence against political opponents, critics and journalists, observers said.
The move was an unexpected turn after weeks of controversy over allegations of an assassination plot against the president.
A police informant and self-described Sri Lankan anti-corruption activist, Namal Kumara, said last month that he had a taped conversation with Nalaka de Silva, head of the terrorism investigation department, describing a plan for a hired killer to assassinate Sirisena.
An Indian man whom authorities identified as M. Thomas was arrested at Kumara's house on suspicion of involvement in the plot. Thomas appeared in court Tuesday and was sent to a psychiatric hospital for further medical examination.
The alleged plot created a huge uproar and threatened to damage relations between Sri Lanka and neighboring India, after an Indian newspaper reported that Sirisena had accused India's intelligence services of involvement. Sirisena denied the newspaper's account.
Police say they are investigating the claim and that Kumara has been questioned but not charged with any offense.
Police arrested de Silva on Thursday, not for the alleged plot against Sirisena but on suspicion of plotting to kill his deputy, Prasanna Alwis.
It was not immediately clear whether either of the alleged plots were connected to Sirisena's ouster of Wickremesinghe, which ended an uneasy coalition government formed by their two bitterly opposed political parties on a pledge to tackle corruption.
Sirisena, who was health minister under Rajapaksa, and Wickremesinghe joined forces to defeat Rajapaksa in the 2015 election. Sirisena was elected president largely through votes from Wickremesinghe's party.
After winning the presidency as a neutral candidate, Sirisena accepted an offer from Rajapaksa to take over his Sri Lanka Freedom Party. Since then, party rivalries have simmered within the government, with Rajapaksa leading a splinter Freedom Party group.
Members of Wickremesinghe's government called Friday's move a coup.
"The appointment of Mahinda Rajapaksa as prime minister is unconstitutional and illegal. This is an undemocratic coup," Mangala Samaraweera, finance minister of the outgoing government, said on Facebook.
A private TV network loyal to Rajapaksa televised him being sworn in as the new prime minister.
Rajapaksa then visited a Buddhist temple in Colombo -- a typical rite of passage for new leaders to receive religious blessings.
Some 200 supporters, some carrying photographs of him, gathered outside Rajapaksa's home late Friday to congratulate him. One of them, Amal Prasanna, said the move was "totally unexpected" but that he was happy Rajapaksa had returned.
"We expect economic development and a good future for our children," he said.
Traditionally, Sirisena's Sri Lanka Freedom Party has espoused left-of-center views and opposed economic liberalization, while Wickremesinghe's United National Party leans right and has championed reforms to open up Sri Lanka's economy.
His government also pledged justice for those accused of committing atrocities in Sri Lanka's civil war during Rajapaksa's rule.
Wickremesinghe had survived a no-confidence motion in Parliament in April, which was brought by supporters of Rajapaksa. The main allegation against Wickremesinghe involved his appointment of a Singaporean as the central bank governor who is now accused of leaking inside information to benefit his son-in-law in a treasury bond sale.