Voters in the Maldives have chosen the brother of the archipelago nation's former strongman ruler to be their new president over the country's first democratically elected leader in a closely fought runoff election.

With just four out of 475 ballot boxes to be counted, Yaamin Abdul Gayoom had 51.39 percent of the total vote in Saturday's election. Gayoom is the brother of former autocrat Maumoon Abdul Gayoom, who ruled this Indian Ocean nation for 30 years.

Mohamed Nasheed, who was elected president in the first multiparty election in 2008, received 48.61 percent of the vote. He had 47 percent in last week's first round to Gayoom's 30 percent. The runoff was required because no candidate got 50 percent.

Maldives had failed to elect a president in three attempts since September.