Updated

The Maldives' Supreme Court ordered the release of imprisoned politicians, including exiled ex-President Mohamed Nasheed, saying their guilty verdicts had been politically influenced.

The ruling set off hours of clashes in the streets of Male, the capital, and could allow Nasheed, the nation's first democratically elected president and the main rival of President Yameen Abdul Gayoom, to challenge Yameen when he seeks re-election later this year.

A look at what led to the turmoil:

AN AUTOCRAT AND ELECTIONS

The Maldives, an Indian Ocean archipelago of nearly 1,200 islands with a population of just 390,000 people, was ruled for three decades by strongman Maumoon Abdul Gayoom. He was voted from office in 2008 in the first democratic elections. Mohamed Nasheed won that vote but resigned in 2012 amid public protests for ordering the arrest of a senior judge. In 2013, Nasheed lost a chaotic presidential election to the current president, who is half brother of the longtime ruler.

___

DEMOCRACTIC SETBACK

Yameen and his ruling Progressive Party of Maldives have rolled back many of the democratic gains seen in the archipelago since 2008, with all of his potential political opponents either jailed or in exile. The government has also curbed freedom of speech and assembly, with heavy fines imposed on journalists and social media users found guilty of defamation. In 2015, Nasheed was sentenced to 13 years in prison for ordering the judge's 2012 arrest. He received asylum in Britain after traveling there on medical leave.

___

THE OPPOSITION AND THE AUTOCRAT (AGAIN)

Former strongman Maumoon Abdul Gayoom has broken with his half brother and at least eight ruling party lawmakers loyal to Gayoom have defected from the ruling party, saying they would work with Nasheed's opposition Maldivian Democratic Party to stop the reversals in democracy. In March 2017, Nasheed, Gayoom and two other parties signed an agreement to form an opposition alliance. In July, Maldivian security forces locked down parliament on Yameen's orders, as the alliance mounted an attempt to impeach the parliamentary speaker, the president's ally.