Mexico City (CNN) Mexican voters headed to the polls Sunday to choose their next president and thousands more elected officials in a historic and consequential election marred by violence.

Voting ended in Mexico City at 9 p.m. ET. Preliminary results were expected to start coming in three hours later.

Within an hour of polls closing, three of the four presidential candidates conceded defeat to leftist frontrunner Andres Manuel Lopez Obrador, who has pledged to crack down on corruption and violence and to stand up to US President Donald Trump.

Mexico's presidential candidates, from left: Ricardo Anaya, Andres Manuel Lopez Obrador, Jose Antonio Meade and Jaime Rodriguez Calderon.

For many of the 89 million eligible Mexican voters, Sunday's election was a referendum on the country's political elite and its economic direction, as well as the tenure of current President Enrique Peña Nieto, who is limited to a single six-year term.

Mexican millennials and the so-called Generation Z, many of whom have grown up surrounded by rampant corruption and drug violence, were expected to play a key role in choosing the country's direction on Sunday. Nearly 13 million voters between the ages of 18 and 23 were expected to vote for the first time, according to election officials.

Read More