MALÉ, Maldives — Political opponents of the Maldives government clashed with the police on the streets of the capital early Friday after the Supreme Court overturned the conviction of a former president living in exile in Britain and ordered the release of several other imprisoned politicians.

Hundreds of people celebrated in Malé, the capital, by waving the country’s flag after the court overturned verdicts against former President Mohamed Nasheed and a former vice president that were the result of trials that were internationally condemned. The court said in its ruling late Thursday that the guilty verdicts had been influenced by the government.

The police dispersed the crowds from the streets using pepper spray and batons. Rocks were thrown at police officers, and at least one injured officer was seen being carried to a hospital.

The ruling could allow Mr. Nasheed, the country’s first democratically elected president, to challenge President Abdulla Yameen when he seeks re-election later this year. Mr. Yameen, also known as Yameen Abdul Gayoom, is the half brother of former President Maumoon Abdul Gayoom.