FEW political parties are as cunning at forging alliances of convenience as Mexico’s Institutional Revolutionary Party (PRI). During economic crises in the 1980s and 90s it persuaded businesses and unions to join “solidarity” pacts that forced them to freeze prices and wages. In the late 1980s it struck a deal of sorts with the conservative National Action Party (PAN), surrendering a few governorships in exchange for approval of sweeping economic reforms.

But when thrown into opposition from 2000-12, the PRI resolutely blocked calls for co-operation. Its obstinacy helped to frustrate the presidency of Felipe Calderón, whose nominated successor was crushed by Enrique Peña Nieto, the PRI’s candidate, in a presidential election last year. Why, then, have Mexico’s opposition parties obediently tagged along with the PRI in a new alliance, known as the “Pact for Mexico”, which is allowing Mr Peña to race through his legislative agenda?

The pact, launched the day after Mr Peña took office on December 1st, secures cross-party backing for a package of long-overdue reforms. It has already made possible an overhaul of education and a law to tackle monopolies in telephony and broadcasting. But the alliance is under strain. In the run-up to local elections held in almost half the states on July 7th, the PAN and the leftist Party of the Democratic Revolution (PRD) threatened to pull out of the pact, demanding that the government stop local PRI bosses from using electoral dirty tricks honed during its seven decades in power in the 20th century.

In the end (and despite a surge of violence ahead of the polls) the results offered something for everyone. Though the PRI won almost half the 931 city halls up for grabs, the PAN toppled it in some big cities. In alliance with the PRD, it claimed victory in a governor’s race in Baja California, which it has held for 24 years. But Juan Molinar, the PAN’s spokesman, still says the PRI’s behaviour during the election undermined faith in the pact. “Every time we have offered proof of [electoral] irregularities, there has been no response. Absolutely none,” he says.

Nonetheless, neither opposition party appears ready to renege on the pact just yet. The PAN says that its careful dealing with the PRI in the 1990s helped to earn it the public support necessary to win the presidency in 2000; it hopes to achieve something similar through the current pact. The PRD says some of the pact’s achievements, such as the monopoly-busting telecoms law, have been high on its agenda for years. Like the PAN, it hopes to use the alliance to negotiate political reforms that would weaken the PRI in some of its regional strongholds. Members of both parties note that the alliance has not necessarily benefited Mr Peña’s popularity greatly: his approval rating, 57% at the last count, has not improved much since he took office.

But the opposition parties are also bound to the pact by their weakness. The PAN was thrown from the presidency into third place in last year’s election, and has been bitterly divided since. Its leader, Gustavo Madero, has been fighting for his political life all year; his direct line to the president, courtesy of the pact, gives him more clout than he would otherwise enjoy.

The PRD, meanwhile, has suffered the departure of its former rabble-rousing presidential candidate, Andrés Manuel López Obrador. The pact helps the party to portray itself as a moderate, centre-left alternative to Mr López Obrador’s fiery populism. That will be tested later this year when members of the pact begin discussion of one of the left’s biggest bugbears, the opening up of the hidebound state oil industry. Mr López Obrador waits in the wings to pick up the votes of the disaffected poor.

The peculiar context of Mexican politics makes the pact especially compelling. According to Enrique Krauze, a historian, when the PRI lost its long grip on power in 2000 the new PAN leadership should have forged a “government of national unity” with the left to dismantle the monopolies and bureaucracies of the PRI era. It didn’t, and years of political paralysis followed.

It may be that today’s alliance represents a belated realisation of that idea, 13 years on. The drug-related violence that has racked Mexico in recent years provides a new reason for politicians to pull together. “This pact is truly something of great merit,” says Mr Krauze. “For the first time in our history the parties are learning to work together in a democratic context.” Yet there is also something familiar about the deal: its principal beneficiary, as so often before, is the wily PRI.