Former Maldives president and current opposition leader Mohamed Nasheed, in white, tussles with policemen who stopped him from speaking to journalists in Male, Maldives, Monday, Feb. 23, 2015. (AP Photo/Sinan Hussain)

A court in the Indian Ocean archipelago nation of the Maldives sentenced the country's former president Mohamed Nasheed to 13 years in prison for alleged "terrorism." The charges relate to when Nasheed was in power in 2012 and ordered the detention of a controversial judge.

"Nasheed is found guilty of arresting and illegally detaining judge Abdulla Mohamed," declared judge Abdulla Didi, when handing down the sentence around midnight on Friday.

Nasheed and his supporters maintain that the charges are "blatantly politicized" and designed to snuff out any chance that he could contest an election again. Two of the three judges presiding over the trial also appeared as witnesses for the prosecution. Nasheed's lawyers quit in protest four days ago, arguing that they had not been given adequate time to prepare a defense.

Nasheed was also the victim of a shocking display of police abuse and violence when entering custody on Feb. 23. Scenes of Nasheed being beaten and dragged were documented by onlookers and media. Amnesty International issued a memo earlier this month condemning the Maldivian government for its "mistreatment" of Nasheed and "selective approach to justice."

The Maldives, a country of hundreds of coral lagoons with a population barely above 300,000 people, is most well-known as a dream holiday destination for honeymooners and well-heeled tourists. The medieval Arab traveler Ibn Batuta described the archipelago as "one of the wonders of the world." But the country's troubled politics are anything but picture-perfect.

In 2008, Nasheed became the Maldives' first democratically elected president, ending more than three decades of de facto dictatorship under the long-ruling autocrat Maumoon Abdul Gayoom. Before that, Nasheed had spent many years in prison as a political dissident.

"Few have been tortured, or brutalized, as much as I have," he told me in a 2009 interview in Male, the country's capital, while sitting in the presidential palace.

He was compelled to resign in 2012 after his political opponents stirred up protests following his removal of the judge in question, whom Nasheed and others considered tied to the cronyism of the previous regime.

Elections were held in 2013, and Nasheed was ultimately defeated by Gayoom's half-brother Abdulla Yameen. Nasheed's camp complained of meddling by the government to tilt the elections against them.

Foreign governments, including the United States and India, have expressed their dismay over Nasheed's arrest and the conduct of the trial.

After the court's sentence was announced, Maldivians expressed outrage on Twitter. Protests have been taking place regularly in Male and there's a good chance they'll grow again. One of Nasheed's aides tweeted messages from the convicted former president:

In his brief tenure in office, Nasheed became a darling of the international media -- a suave democracy campaigner who had also become a leading global figure in the debate over climate change. Nasheed was the main protagonist of the critically acclaimed documentary "The Island President."

But Nasheed's celebrity overseas could not protect him from the entrenched interests of the old regime.

"You can get rid of a person very easily, but the networks, the intricacies, the establishments — you have to flush them," he told me in an interview following his ouster in 2012. "You can get rid of a dictator, but you can’t get rid of a dictatorship."