COLOMBO, Sri Lanka — Sri Lanka’s Supreme Court on Tuesday blocked the president from dissolving Parliament, raising the possibility that the former prime minister could reclaim the post after weeks of unnerving political drama.

Sri Lanka has been in crisis since late last month, when President Maithripala Sirisena abruptly fired Prime Minister Ranil Wickremesinghe, accusing him of being inept and corrupt. He then swore in a new prime minister: Mahinda Rajapaksa, a popular former president who has been accused of human rights abuses. Many lawmakers and government ministers denounced the move. Protests erupted, and at least one person was killed.

Insisting his firing was unconstitutional, Mr. Wickremesinghe refused to leave his official residence and demanded that Parliament be summoned to prove he still had support.

Instead, Mr. Sirisena dissolved Parliament and called for new elections. Opponents said he had done so because Mr. Rajapaksa could not assemble a majority. The maneuverings were seen as a back door way to bring Mr. Rajapaksa and his allies back into power.