COLOMBO - The exiled former leader of the Maldives vowed Friday to run for president after the Supreme Court quashed his conviction, dealing a major blow to the ruling regime.

Mohamed Nasheed, the country's first democratically elected president, has urged the government to respect the top court's shock decision to overturn the convictions of nine dissidents and order the release of those serving jail sentences.

However, the joint opposition, which includes Nasheed's Maldivian Democratic Party (MDP), expressed fears that the government may not carry out the Supreme Court's order.

" We are deeply fearful that the government's refusal to implement the Supreme Court order could escalate to unrest and incite violence across the country," the joint opposition said in a statement on Friday night. Earlier, Nasheed had said the ruling cleared the way for him to return to the Maldives, a South Asian atoll nation known as a honeymooners' paradise.

"I can contest and will contest," he told AFP in the Sri Lankan capital Colombo.

"We must set up proper procedures for inclusive, free and fair elections with full international observation."

Nasheed, 50, said the government should withdraw the troops deployed inside the parliament since July last year, when a dozen MPs from President Abdulla Yameen's party defected and attempted to impeach the pro-government speaker.

The Supreme Court on Thursday reinstated the 12 legislators who were expelled for defecting, and effectively gave the opposition a majority in the 85-member assembly.

The United Nations, Australia, Britain, Canada, India and the United States welcomed the court's decision as a move towards restoring democracy in the politically troubled Indian Ocean nation.

"I urge the Government and security services to respect this ruling, which bolsters #democracy and #RuleOfLaw for all Maldivians," tweeted Atul Keshap, the US ambassador to Sri Lanka and the Maldives.

However, the Maldivian government made it clear on Friday evening that it had concerns about releasing those who had been convicted for "terrorism, corruption, embezzlement, and treason".

President Yameen's office said Attorney General Mohamed Anil has raised the administration's concerns with the Chief Justice.

"The Attorney-General stated that the administration has highlighted concerns over the consequences that maybe presented in the immediate implementation of the court's ruling," the statement said.

Nasheed's MDP, which has criticised the country's "highly corrupt judiciary" in the past, saw the unexpected decision as the "end of Yameen's authoritarian rule".

He was barred from contesting any election in the Maldives after a controversial 2015 terrorism conviction widely criticised as politically motivated.

The Supreme Court said Friday that the "questionable and politically motivated nature of the trials of the political leaders warrant a retrial".

The beleaguered administration said it had not been heard by the Supreme Court and did not say when it would fully comply with the landmark ruling.

The ruling - published on the court's website and broadcast by private media outlets - brought opposition activists onto the streets in celebration Thursday night, sparking clashes with police who fired tear gas to disperse the crowd.

It threatens to isolate Yameen, who has faced unsuccessful opposition attempts to impeach him for alleged corruption.

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 his political opponents.

Nasheed, a charismatic and high-profile climate change campaigner, was sentenced to 13 years in jail after his 2015 conviction.

In 2016, he was granted prison leave for medical treatment in London, where he secured political asylum.

A UN panel ruled that his imprisonment was illegal.

Police have said they will implement the Supreme Court's decision but within minutes of the announcement, the government sacked the police chief, saying Yameen had been unable to contact him to maintain law and order.

"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.

Streets in the Maldives, a nation of 340,000 Sunni Muslims, were relatively empty on Friday .

Witnesses said police had stopped dozens of activists from gathering in the main square of the capital Male after Friday prayers.