Maldives President Abdulla Yameen was expected to cement his grip on power in the tropical archipelago in an election that opposition and international groups have criticised for a lack of transparency and the suppression of dissent.
Maldives opposition candidate Ibrahim Mohamed Solih, who fought a bitter election campaign against incumbent President Abdulla Yameen, said that he had won Sunday's presidential vote with a 16 percent margin after 92 percent of votes had been counted.
The opposition candidate had an unassailable lead of 34,000 votes over Yameen with just 27,000 votes to be declared late on Sunday, according to polling station results broadcast over local media.
"This is a moment of happiness, a moment of hope. This is a journey that has ended at the ballot box because the people willed it," Solih, popularly known as Ibu, told reporters in Male.
"The message is loud and clear. The people of Maldives want change, peace and justice. I would like to call on President Yameen to accept the will of the people and begin a smooth transition of power as per the constitution."
Polling booths in the Maldives closed Sunday after three hours of extended voting in a controversial election marred by police raids on the opposition and allegations of vote rigging in favour of strongman president Yameen.
Yameen has imprisoned or forced into exile all his main rivals, and is expected to retain his hold on power in the Indian Ocean island nation.
Foreign monitors and the opposition have slammed his government for its crackdown on opponents and the media, and urged the international community not to recognise the results of the election.
Before polls opened, police raided the campaign headquarters of the opposition Maldivian Democratic Party (MDP), searched the building for several hours in a bid to stop what they called "illegal activities".
There were no arrests.
Despite the crackdown, hundreds of Maldivians headed to polling booths before voting began in the capital Male.
"There is a lot of enthusiasm. Voters lined up to vote despite overcast weather," MDP party worker Shauna Aminath said.
Yameen has borrowed hundreds of millions of dollars from China to build up infrastructure, alarming the nation's longtime backer India.
The European Union has said it is ready to impose travel bans and asset freezes on individuals "if the situation does not improve", while the United States has warned it would "consider appropriate measures" against those undermining democracy in the country of 1,200 islands.
Some 262,000 people in the archipelago – famed for its white beaches and blue lagoons – can vote in an election from which independent international monitors have been barred.
Only a handful of foreign media have been allowed in.
The Asian Network for Free Elections, a foreign monitoring group, said the campaign was heavily tilted in favour of the 59-year-old Yameen.
The network said it did not expect a fair contest.
"In the absence of any scrutiny (of the elections) or pressure (on the government), sombre events surely loom ahead for the people of Maldives," it said on the eve of the vote.
In February, Yameen alarmed the international community by imposing a state of emergency, suspending the constitution and sending troops to stop members of parliament who were trying to impeach him.
The chief justice and a judge of the Supreme Court were jailed along with Yameen's half-brother Maumoon Abdul Gayoom, president for 30 years until 2008 and the man who helped Yameen come to power in 2013.
The UN said the arrest of judges was an "outright assault on democracy".
Ahmed Tholal has more from Male.
Mohamed Nasheed, the Maldives' first democratically elected president from 2008-12 but now in exile, called on Friday for the international community to reject the election results.
"Mathematically, it is not possible for Yameen to win because all opposition parties are united against him," said Nasheed, who is based in Sri Lanka.
"But the results they will announce will be different to what is actually in the ballot boxes."
Nasheed was forced to withdraw from the presidential race after the Maldives election commission disqualified him because of a 2015 terrorism conviction.
The United Nations said the conviction and 13-year jail sentence were politically motivated, but Yameen's government has refused to abide by the UN ruling.
The relatively unknown Solih has Nasheed's backing. There are no other candidates.
Solih has struggled for visibility with the electorate because the media is fearful of falling foul of heavy-handed decrees and reporting restrictions.
The government has used "vaguely worded laws to silence dissent and to intimidate and imprison critics", some of whom have been assaulted and even murdered, according to Human Rights Watch.
Eligible voters in neighbouring Sri Lanka and India along with those in Malaysia and Britain were entitled to vote on Sunday.
A candidate must secure 50 percent of the vote to win outright, failing which there would be a run-off three days later.