Opposition presidential candidate Ibrahim Mohamed Solih has declared victory in a contentious Maldives election widely seen as a referendum on the island nation’s young democracy.

Mr Solih’s win, announced at his party’s campaign headquarters in the capital city of Male, was unexpected.

The opposition had feared the election would be rigged in favour of strongman President Yameen Abdul Gayoom, whose first term was marked by a crackdown on political rivals, courts and the media.

“People were not expecting this result.

“Despite the repressive environment, the people have spoken their minds,” said Ahmed Tholal, a former member of the Human Rights Commission of the Maldives and a project coordinator at the nonprofit watchdog Transparency Maldives.

Maldives Elections
Supporters of Ibrahim Mohamed Solih celebrate their victory in Male (Eranga Jayawardena/AP)

A democracy activist during the Maldives’ decades of autocratic rule and former Parliament majority leader, Mr Solih, 56, became the Maldivian Democratic Party’s presidential candidate by process of elimination, other opposition leaders had been jailed or exiled by Mr Yameen’s government.

Party leader and former President Mohamed Nasheed, in exile in Sri Lanka, had hoped to run again but was disqualified because of an outstanding prison sentence in the Maldives.

Famed for its sandy white beaches and luxury resorts, the Maldives under Mr Yameen have seen economic growth and longer life expectancy, according to the World Bank.

But Mr Yameen’s critics, including Mr Solih, said he systematically rolled back democratic freedoms.

Maldives Elections
Maldivian polling workers prepare to count ballots (Eranga Jayawardena/AP)

Mr Solih campaigned door to door, promising at rallies to promote human rights and the rule of law, a message that resonated with voters who saw signs the Maldives were slipping back to autocratic rule, just a decade after achieving democracy.

“Ibu is totally different from Yameen, because Yameen is a dictator and a brutal person.

“Ibu is a very mild person who listens to everyone,” said Ahamed Fiasal, a 39-year-old IT business owner, using Mr Solih’s nickname.

Still, Mr Fiasal said, the result was surprising because “no one thought that Yameen would lose like this.

“He had all the power, the judiciary, the police, the security forces under him.

“It seemed he might rig the election even at the last minute and would win somehow or the other.”

Mr Solih’s supporters flooded the streets, hugging one another, waving the Maldivian flag, cheering and honking horns in celebration.

Mr Yameen’s campaign did not concede the race, and no one from the campaign could immediately be reached for comment.

But Mr Solih had 58.3% of the vote with nearly 97.5% of ballots counted early Monday, according to independent newspaper website mihaaru.com.

A spokesman for Maldives’ Election Commission said official results would not be announced until September 29, allowing a week for parties to challenge the results in court.

Mr Solih, surrounded by thousands of his supporters, urged calm until the commission had announced the results.

In his victory speech, Mr Solih called the election results “a moment of happiness, hope and history,” but said that he did not think the election process had been transparent.

Maldives Elections
Ibrahim Mohamed Solih, centre, shakes hands with a supporter as his running mate, Faisal Naseem, right, addresses the gathering (Eranga Jayawardena/AP)

A police raid on Mr Solih’s main campaign office the night before the election was seen by the opposition as a worrying sign that Mr Yameen would “muzzle his way” to re-election, according to Hamid Abdul Gafoor, an opposition spokesman and former Maldives politician now based in Colombo, Sri Lanka.

Few foreign media organisations were allowed in to cover the election.

Mr Yameen used his first term to consolidate power, jailing opponents, including his half brother, a former president, and two Supreme Court Justices.

In February, Mr Yameen declared a state of emergency, suspended the constitution and ordered troops to storm the Supreme Court and arrest judges after they had ordered the release and retrial of those jailed after politically-motivated trials.

Maldives Elections
Voters display indelible ink on their fingers after casting ballots (Mohamed Sharuhaan/AP)

The Supreme Court ordered the release of Mr Nasheed and many other political leaders.

The European Union had said that it was not sending election observers because the Maldives had failed to meet the basic conditions for monitoring.

The US had threatened to sanction Maldivian officials if the elections were not free and fair.

Despite the turmoil, voters flocked to the polls on Sunday, standing in long queues in rain and high temperatures to cast ballots.

More than 260,000 of the Maldives’ 400,000 people were eligible to vote at about 400 polling stations across the approximately 1,200 islands that comprise the Indian Ocean archipelago.

Voters also stood in long queues in Malaysia, the UK, India and Sri Lanka, where the opposition had encouraged overseas Maldivians to participate.