The remaining three judges of the supreme court said they were rescinding their 1 February order to release the prisoners “in light of the concerns raised by the president”.
The court’s original decision, signed by all five judges, had quashed a terrorism conviction against former president and opposition leader Mohamed Nasheed, among others.
The shock move was seen as clearing the way for Nasheed to end his self-imposed exile and return to the country to contest elections later this year.
But Yameen refused to comply with the order and instead declared the 15-day state of emergency, giving sweeping powers to troops to arrest and detain individuals while curtailing the powers of the judiciary and the legislature.
Maldives chief justice Abdulla Saeed and another judge were then arrested at dawn on Tuesday, after security forces stormed the court complex in the capital Malé.
Nasheed’s Maldivian Democratic Party (MDP) said the U-turn was due to pressure brought on the three judges. “Yameen has used coercion to get the original decision revoked,” MDP spokesman Hamid Abdul Ghafoor told AFP.
The U-turn is seen by opposition activists as a blow to their attempts at toppling Yameen, who is accused of plunging the tiny Indian Ocean nation into political turmoil.
However, the supreme court made no change to its other order to restore the seats of 12 legislators sacked for defecting from Yameen’s party. This in theory gives the dissidents a majority in the assembly, but they are prevented from ousting the president because the declaration of a state of emergency takes away parliament’s power to impeach.
Nasheed has accused Yameen of acting illegally and called on the international community to step in and help remove him from office.
On Tuesday, he urged India to send troops to the strategically located archipelago, which has grown increasingly close to regional rival China under Yameen’s leadership.
“President Yameen has illegally declared martial law and overrun the state. We must remove him from power,” said Nasheed, the first democratically elected leader of the Maldives, in a statement.
Yameen has presided over an escalating crackdown on dissent since he came to power in 2013, battering the image of the upmarket holiday paradise. He has had almost all the political opposition jailed.
The United States said it was “troubled and disappointed” at the declaration of a state of emergency and called on Yameen to comply with the rule of law.
Several countries have warned against travel to the country, which depends heavily on tourism, at the peak of the season.
More about: #Maldives