0227 GMT August 22, 2019
Police fired tear gas to disperse hundreds of opposition supporters who took to the streets late Thursday after the court ruling, a major challenge to the authority of President Abdulla Yameen, presstv reported.
It clears the way for the Maldives' first democratically-elected leader Mohamed Nasheed to return from exile and run for president in elections due this year.
The Maldives' popular image as an upmarket holiday paradise has been severely damaged by a major crackdown on dissent under Yameen, who has overseen the jailing of almost all the political opposition.
"If the situation gets out of hand, the government could declare a state of emergency," a military source told AFP Friday on condition of anonymity.
In another sign of the mounting tensions, the government sacked the country's police chief overnight, saying Yameen had been unable to contact him.
Police had earlier said they would implement the court's decision that those political prisoners being held in jail should be freed pending retrials, although it remains unclear when this will happen.
In a tweet, Nasheed welcomed the Supreme Court's ruling and called for the "immediate release of political prisoners and the restoration of their civil and political rights."
"President Yameen must abide by this ruling and resign," he added.
Nasheed, who is currently in neighboring Sri Lanka, has promised to challenge Yameen for the presidency.
The former president, a charismatic and high-profile campaigner against climate change, was convicted in 2015 on a terrorism charge widely criticized as politically motivated and sentenced to 13 years in jail.
On Thursday, the Supreme Court ruled that his trial and those of the eight other dissidents were seriously flawed.
The court said the "questionable and politically motivated nature of the trials of the political leaders warrant a retrial."
It also annulled the expulsion of 12 legislators who had defected from Yameen's party, and restored their seats in a move that gave the opposition a majority in the 85-member parliament.
"The Supreme Court's verdict effectively ends President Yameen's authoritarian rule," the opposition said in a statement calling for his resignation.
Yameen's spokesman said the court had made its decision without hearing out the government's arguments.
Among those who had their convictions quashed is Yameen's former deputy, Ahmed Adeeb, who is serving a 15-year jail term after being convicted on a charge of attempted assassination in September 2015.
By early Friday morning, the streets of the capital, Male, were relatively empty. Residents said there could be more demonstrations after Friday prayers in the nation of 340,000 Sunni Muslims.