Newly elected Andrés Manuel López Obrador has become the first leftist president of Mexico since the end of one-party rule in 2000. López Obrador said he would pursue friend and foe alike in a crackdown on corruption after voters handed him a powerful mandate for government with a landslide election victory on Sunday.
López Obrador, won between 53 and 53.8 percent of votes, according to a quick count by the electoral authority, more than double the total for his nearest rival.
That would be the biggest share of the vote since the early 1980s, and would give López Obrador a strong platform both to address Mexico's internal problems and face external challenges like the threat of a trade war with the United States.
Going into Monday it was unclear whether López Obrador had done enough to secure the first outright majority in Congress in over 20 years, with pollsters' early estimates suggesting he was close in the lower house but farther away in the Senate.
Speaking to reporters after his win, López Obrador identified corruption as the "principal cause" of inequality and the criminal violence that has bedeviled Mexico for years, and said he would spare no one in his commitment to root it out.
"Whoever it is will be punished, I include comrades, officials, friends and family members," the 64-year-old said. "A good judge begins at home."
The election was a crushing defeat for the ruling centrist Institutional Revolutionary Party, or PRI, which governed Mexico from 1929-2000 continually and again from 2012.
Public anger over corruption scandals, which have shattered the PRI's credibility, was a defining feature of the campaign, alongside nationwide discontent over soaring levels of violence and years of lackluster economic growth.
López Obrador, a former Mexico City mayor, was greeted with rapturous cheers by supporters in the capital's Zocalo central square around midnight, while friends celebrated in his tiny hometown of Tepetitan, in the poor southern state of Tabasco.
The victory was a vindication for López Obrador, who was written off by many critics after narrowly failing to capture the presidency at his first bid in 2006.
Then, he cried fraud and declared himself the rightful winner, but alienated many supporters with huge street protests that brought much of the capital to a standstill for weeks.
He also began campaigning relentlessly around Mexico with the message that he alone could fix the country's problems, calling out his opponents as corrupt and inept.
Finishing second again in 2012, he remained the most visible opposition leader and by this year had become the focal point of public frustration with the establishment's shortcomings.
Once results showed his margin of victory on Sunday, and mindful of accusations that his instincts cleave toward authoritarianism, López Obrador quickly sought to calm nerves about his presidency. He pledged to pursue responsible economic policies, respect private property and guarantee individual liberties.
And he paid tribute to the role in the campaign played by outgoing President Enrique Peña Nieto and the media, both of which have felt the bite of his scorn in the past.
Mexican presidents are limited by law to a single term.
López Obrador will take office in December facing a US government that has been openly antagonistic to Mexico over trade and migration under President Donald Trump.
The newly elected president has said he wants to make Mexico more economically independent of the United States. At the same time, he also hopes to persuade Trump to help develop Mexico and Central America in order to contain illegal migration.
Andrew Selee, president of the Migration Policy Institute in Washington, saw a change from past Mexican leaders who were "obsessed" about being on good terms with the United States
"It means that the US can't take Mexico for granted any more," he said. "López Obrador will be pragmatic ... but he's not going to bend over backwards to have a good relationship."
By Dave Graham/Reuters
Reporting by Dave Graham; Additional reporting by Julia Love, Christine Murray, Anthony Esposito, Berengere Sim and Delphine Schrank; Editing by Frank Jack Daniel and Catherine Evans.