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.
The President in his letter said that Ranil Wickremesinghe was removed as per provisions in the constitution under 42 (4) and the President also told that it was him who appointed Wickremesinghe.
Al Jazeera's Minelle Fernandez, reporting from Colombo, said Rajapaksa's shock appointment has brought uncertainty to Sri Lanka amid questions whether the president has the power to dismiss the prime minister.
The SLFP is headed by current president o the country - Maithripala Sirisena. In a telephonic conversation with a TV station, Wickremesinghe said "I will continue to be the Prime Minister".
The political developments unfolded after Sirisena's broader political front United People's Freedom Alliance (UPFA) announced that it has made a decision to quit the current unity government with Wickremesinghe's UNP. They would also quite correctly have concluded that technical illegalities would not effectively be justiciable, because it is unlikely in the extreme that the Sri Lankan courts would risk a venture into such a high-stakes political game.
Mahinda Rajapaksa was sworn in as the new Prime Minister of Sri Lanka before the President at the Presidential Secretariat, the President's Media Division confirmed.
Last week, it was reported that Mathripala Sirisena accused his senior coalition partner the UNP of not taking seriously an alleged conspiracy to assassinate him and Gotabhaya Rajapaksa, the former top defence ministry bureaucrat and brother of ex-president Mahinda Rajapaksa. And it will lead to an unprecedented constitutional crisis because there are now two competing Prime Ministers and their parties jostling for power, authority, and legitimacy at the very heart of the state.
But Wickremesinghe later told reporters he remained the prime minister.
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 alleged plot briefly threatened to cause tension between Sri Lanka and India, after an Indian newspaper report that Sirisena had accused India's intelligence services of involvement - a claim New Delhi and Colombo have both denied.
Sri Lanka's President Maithripala Sirisena formed a coalition government with Wickremesinghe's party soon after Sirisena unexpectedly defeated former ally Rajapaksa in a presidential election in January 2015.
Responding to Samaraweera, Rajapaksa's son, Namal Rajapaksa, took to Twitter as well, and said, "Following withdrawal of UPFA from Government, the Cabinet is dissolved and post of PM is vacated as per Article 48 (1)".
"What the president now should do immediately is to summon Parliament and have a vote". Since then, party rivalries have been simmering within the government.
The sudden political development ends an over three-year-old coalition government that was formed by Sirisena and Wickremesinghe on a promise to combat corruption and financial irregularities.