President Ibrahim Boubacar Keita and opposition leader Soumaila Cisse to compete in second round of voting on August 12.

Mali's presidential election will go to a runoff vote after President Ibrahim Boubacar Keita came in first but failed to secure enough votes to win a second term in office outright, according to preliminary figures.

The Ministry of Territorial Administration said on Thursday that Keita won 41.4 percent of Sunday's vote, while his main rival Soumaila Cisse came in second with 17.8 percent.

The two, who also went to a runoff vote in 2013, will contest the second round of voting on August 12.

A candidate needed to obtain more than 50 percent of the votes to win outright.

Businessman Aliou Boubacar Diallo came in third with 7.95 percent, while former NASA employee Cheick Modibo Diarra received 7.46 percent. The constitutional court has three days to validate the results.

The ministry said there was a 43 percent participation rate among Mali's more than eight million registered voters, in a poll that took place under the threat of attack from armed groups.

Sunday's vote was marred by claims of irregularities and unrelated attacks by suspected armed groups that prevented thousands from voting.

Attackers shut down 644 polling stations, representing about three percent of the total. About a fifth were troubled by violence, according to government figures.

That has fueled doubts about the election's credibility and worries that it did not fully reflect the will of Malians, large numbers of whom are spread across a vast desert where groups with links to al-Qaeda and ISIL roam.

In the past three years, attacks have tripled and violent deaths have doubled, according to civil society website Malilink.