Maldives police disperse crowds celebrating court's freeing of opposition leaders
Maldives police have fired tear gas at crowds of opposition supporters celebrating a Supreme Court ruling.
A reporter said police told crowds they would "not be responsible for damage inflicted by using force".
The court ordered the immediate release and retrial of the exiled former president Mohamed Nasheed and other opposition leaders.
It said their trials had violated the constitution. The opposition says they were politically motivated.
The court decision effectively restores the opposition's majority in parliament, reinstating 12 members who had been stripped of their seats.
Mr Nasheed was the island's first democratically elected leader and the opposition parties have called for President Abdulla Yameen to resign.
Shortly after the ruling the police announced on Twitter that it would enforce it.
However, the police commissioner, Ahmed Areef, was then dismissed by Attorney General Mohamed Anil at a hastily convened late-night press conference.
The attorney general said Mr Areef had been sacked because he was uncontactable following the court order. Local media reported that he also said the president was "disheartened" by the police commissioner's decision to enforce the ruling.
The president's office later said it accepted the ruling and would comply with it.
Analysis: 'Tumultuous politics'
by Olivia Lang, BBC News
Thursday's verdict is a huge gain for the Maldivian opposition, which has been vying to oust the president for years.
It hasn't seemed like a battle they would win. Abdulla Yameen has kept a firm grip on power, overseeing the arrest of political opponents and restricting political protest and press freedom.
There is little left of the democracy that the Maldives became in 2008.
Every time the opposition tried to play a hand, Mr Yameen stopped them in their tracks. Last July, when the opposition had enough MPs to impeach the speaker of the parliament - an ally of Mr Yameen - troops were deployed to prevent them entering the building.
Mr Nasheed has told the BBC he plans to return and compete in the elections due to take place later this year, although he did not say when.
In the tumultuous world of Maldivian politics, things can change very quickly.
The country has seen political unrest since Mr Nasheed was convicted in 2015. His conviction and 13-year sentence was internationally condemned, and he was given political asylum in the UK. However, he is currently in Sri Lanka.
Former Vice-President Ahmed Adheeb Abdul Ghafoor and other opposition leaders were among the others named in the Supreme Court's order.
It called for their immediate release and said the "questionable and politically motivated nature of the trials of the political leaders warrant a re-trial".
Mr Nasheed told the BBC: "President Yameen must abide by the Supreme Court ruling and release the political leaders immediately."
"President Yameen must also release other democracy activists in jail."
Allow Twitter content?
The US ambassador to the Maldives urged the country's leader to respect the court's judgement.
The Indian Ocean nation has been independent from Britain for 53 years, during which time it was ruled for decades autocratically by then President Maumoon Abdul Gayhoom.
It became a multi-party democracy in 2008, but since President Yameen took power in 2013 it has faced questions over freedom of speech, the detention of opponents and the independence of the judiciary.
The nation is made up of 26 coral atolls and 1,192 individual islands, and is popular among foreigners as a luxury tourist destination.