Mexico’s President Enrique Peña Nieto delivers a speech in Mexico City on Dec. 20, 2016. (Edgard Garrido/Reuters)

Christy Thornton is 2017-2018 fellow at the Weatherhead Initiative on Global History at Harvard University, and a board member at the North American Congress on Latin America.

Earlier this month, a massive sinkhole opened suddenly in the middle of a new expressway south of Mexico City, swallowing a car and killing the two passengers inside. There could hardly be a more apt metaphor for the cratering legitimacy of Mexico’s president, Enrique Peña Nieto, and his ruling Institutional Revolutionary Party (PRI).

In the context of a global wave of anti-establishment politics, it’s hard to imagine a more establishment party than the PRI, which controlled Mexico with its soft-authoritarian, one-party structure for most of the 20th century. Now the party, once the glue that held the Mexican political system together, fastened tightly to a strong executive branch, is quickly losing its grip.

Peña Nieto celebrated the opening of his new expressway just three months ago. Huge billboards were erected personally thanking him for its construction. Towering over the lanes, huge letters read, “Gracias, Señor Presidente.” As soon as the crumpled car was pulled from the rubble by a crane, workers were dispatched to take down the billboards.

The sinkhole disaster is just the latest in a endless series of scandals facing the president, including forcibly disappeared students, government contractor kickbacks, an escaped drug kingpin, a botched visit by then-candidate Donald Trump, a sharp spike in gas prices, steady increases in rates of violence and murder, and revelations of government spyware targeting rights groups and journalists. Peña Nieto’s approval rating now hovers between 12 and 20 percent — and this has had serious consequences for his party.

Most telling were last month’s gubernatorial elections in the Estado de México, the country’s most populous state, known as the “cradle of the PRI.” The party has held the governor’s office there for nearly 90 years, and the outgoing governor won his seat with 65 percent of the vote. The PRI’s Alfredo del Mazo — a well-coiffed son and grandson of former governors, and cousin to Peña Nieto — should have easily continued this tradition and won in a landslide. But as the elections approached, polls revealed a tighter race than many expected. It was all the more surprising that the challenger, Delfina Gómez Álvarez, was not affiliated with one of Mexico’s traditional opposition parties but with Morena, the anti-establishment, leftist party founded by Andrés Manuel López Obrador in 2014.

Gómez faced an uphill battle: Having been in power for nearly nine decades means the PRI has a well-oiled machine for winning elections — and much of it operates outside the law. On the morning of the election, Morena officials arrived at multiple local offices to find severed, bloody pig heads piled at their doors. Throughout the day, activists and citizens made hundreds of reports of irregularities by PRI operatives, ranging from illegal transportation to the polls and vote-buying to intimidation and violence — some of which I saw myself as I traveled around the state to observe the polling.

In the end, these dirty tricks helped the PRI hold on to power — but barely. Del Mazo garnered less than 34 percent of the vote, a loss of nearly half the support the party received in the last elections. Morena’s Gómez nearly matched him, with 31 percent, and activists have filed a petition for a full recount, given the documented irregularities and the closeness of the tally.

This is a staggering setback for the PRI. Even in the traditional seat of their power, even with a concerted campaign of less-than-legal tactics, Mexico’s most establishment party is now holding on by the skin of del Mazo’s shiny white teeth. With all eyes now on the 2018 presidential race — where López Obrador is already the presumed front-runner — new polls show that the PRI is in free fall.

When, after more than a decade of opposition rule, voters returned the party to power in 2012, Peña Nieto promised that his was a new PRI, no longer dominated by the so-called dinosaurs who had tightly controlled the one-party state through patronage, corruption and intimidation. But since his inauguration day, hundreds of thousands of people have taken to the street to protest the president — and not just his security failures and corruption scandals, but his liberalizing economic reforms as well. Mexican voters, like voters elsewhere, are tired of politics as usual, which has brought so much inequality and insecurity to the country. López Obrador could capitalize on this discontent and lead the country in a fairer and more democratic direction.

After his election, Peña Nieto was celebrated in the international press, appearing on the cover of Time with the promise that he had “changed the narrative of his narco-stained nation.” But whatever story that Peña Nieto wanted to tell, tales of violence, corruption and impunity have dominated his presidency and tarnished his party. For all of its promises to lead Mexico to a bright new future, the PRI is likely to be swallowed up into a sinkhole of its own making. And while the billboards may have been removed, everyone knows they have the president to thank.