Less than a day after the arrest of the two judges, the remaining three judges rescinded its ruling to release the political leaders referring to the concerns raised by president Yameen in the letters he had sent to the chief justice hours before state of emergency was declared.
Yameen earlier ordered the arrest of the chief justice, another judge Ali Hameed, and the registrar of the court, Hassan Saeed.
The court's shock move in support of the political dissidents on Thursday also included an order for the government to restore the seats of 12 legislators sacked for defecting from Mr Yameen's party.
India has asked the "Government of Maldives to respect and abide by the order of the apex court" and said it "wishes to see a stable, peaceful and prosperous Maldives".
The Indian Ocean nation was thrown into turmoil when the Supreme Court ordered several jailed politicians to be freed last week - something the current leader did not agree with.
The US openly said, "The world is watching".
Maldives president says judges plotted to overthrow him
On Sunday evening, opposition Members of Parliament held a joint meeting and chose to lead a massive protest against President Mohammed Yameen.Demanding justice and a return of the rule of law, they called for the immediate release of all political prisoners.
The Maldives Supreme Court on Tuesday revoked its earlier order to release nine high-profile political prisoners.
The government did not comment on soldiers entering the Supreme Court building or on Gayoom's arrest, but the president's main rival, who lives in exile, urged people not to obey what he called an "unlawful order".
"The US is troubled and disappointed by reports that Maldivian President Yameen has declared a State of Emergency, which gives sweeping powers to security forces to arrest and detain suspects, bans public gatherings, imposes travel restrictions, and suspends parts of the Maldivian Constitution..."
Gayoom was president from 1978 to 2008, when the Maldives became a multiparty democracy. "I had to declare an emergency because there was no other way to investigate these judges", Yameen said in a televised address to the nation.
Former president Maumoon Abdul Gayoom, who has allied himself with the Opposition, was also detained at home.
Super Bowl 52 postgame quotes: Bill Belichick
Malcolm Butler said the Patriots "gave up on me" after he did not play on defense during their Super Bowl 52 loss to the Eagles . I guess I wasn't playing good or they didn't feel comfortable. "Very frustrating", Rowe said. "I didn't know that", Long said.