Latvian lawmakers have failed to elect a new president in four rounds of voting, with front-runner Raimonds Vejonis five votes short of the majority needed to win.

A fifth round will be held later Wednesday.

Vejonis got 46 votes in a runoff against Egils Levits, a judge of the European Court of Justice, who had 26.

Fifty-one votes are needed for a majority in the 100-seat Parliament.

Two other candidates were eliminated in earlier rounds of voting.

The winner will replace incumbent Andris Berzins, who didn't seek another four-year term, citing family reasons.

If neither candidate wins at least 51 votes on Wednesday, a new vote will be held in 10 days.

The ballots are secret and lawmakers don't necessarily follow party lines, making it difficult to predict the outcome.