The Maldives Supreme Court has performed a U-turn on its decision to free nine convicted politicians, hours after the arrest of two of its judges.
The court's remaining three judges have issued a statement saying the order has been revoked "in light of the concerns raised by the president".
President Abdulla Yameen has declared a state of emergency to investigate a "coup" against him.
The opposition has called for other countries to intervene in the crisis.
President Yameen ordered the arrest of Chief Justice Abdulla Saeed and another judge, Ali Hameed, on Monday.
On Tuesday, the president gave a televised address saying: "I had to declare a national emergency because there was no other way to investigate these judges."
The remaining judges then issued a statement saying they were rescinding the original order.
How did we get here?
Last week's original, unanimous court ruling quashed the convictions of nine opposition figures and ordered the release of those behind bars. It said they should all be re-tried.
Among them was exiled ex-President Mohamed Nasheed. The court said his 2015 trial had been unconstitutional.
The ruling also declared that 12 MPs stripped of their seats should be reinstated, which would see the opposition's parliamentary majority restored.
The move took the nation by surprise and the government responded by suspending parliament.
Under emergency rule, security forces are now freer to make arrests, and public gatherings are banned.
The army has been ordered to resist any attempt to impeach or remove President Yameen.
Former President Maumoon Abdul Gayoom, who has allied himself with the opposition, was also detained at his home. Mr Gayoom is the current president's half-brother.
What happens now - BBC's Olivia Lang
It seems that President Yameen has won this battle for now. Through a series of drastic actions, it's become perfectly clear he is not going to allow any challenge to his rule.
If he was already accused of holding a firm grip of power, this recent crisis has only served to tighten it.
Last week's assertion by the opposition that this ruling was a "death knell" for his administration now seems naïve.
Even if elections are held later this year as planned, with all Mr Yameen's political opponents behind bars it's difficult to see how any poll would be credible.
Unless the military decide to mutiny, it's hard to see how he would go.
What has the reaction been?
There has been international condemnation of the government's moves, with the US expressing concern.
Mr Nasheed has specifically appealed for intervention from India, to help release prisoners, and from the US, to curb leaders' financial transactions.
Mr Nasheed became the first democratically elected president of the Maldives in 2008. He was forced to stand down following an army rebellion four years later, and was tried under anti-terror laws in 2015.
He now lives in exile in Sri Lanka.
What does this mean for tourists?
The Indian Ocean island nation is made up of 26 coral atolls and 1,192 islands, and tourism is a vital part of its economy.
The political crisis comes during the country's peak tourism season, when tens of thousands of foreigners visit the Maldives' beaches.
China, the US, India and the UK are among those issuing warnings to travellers in the Maldives.
The UK's Foreign Office said British nationals in the capital, Male, should "exercise caution and avoid any protests or rallies", but that outlying islands and resorts - and the international airport - were not affected.
Tourism was worth $2.7bn (£1.9bn) to the Maldivian economy in 2016. It is the biggest industry in the country - home to just 400,000 people - and could be hit hard if the crisis worsens and puts people off travelling.