MEXICO CITY Throughout Mexico's election campaign, the party that held the country in an iron grip for most of the 20th century was tipped to recapture the presidency by storm and take control of Congress.
In the end, the Institutional Revolutionary Party, or PRI, fell short of a legislative majority and it may now have to lean heavily on two fringe parties to pass reforms.
After his smaller-than-expected victory on July 1, President-elect Enrique Pena Nieto and the PRI are hoping for support from a Green Party with a liking for the death penalty and another group that serves as a political vehicle for the controversial head of the teachers' union.
The PRI won 207 seats in the 500-member lower house of Congress according to projections, and will have just 240 seats with the Greens, its coalition partner. Add the New Alliance Party (PANAL), which is backed by the teachers' union, and the PRI could control exactly half of the seats.
"The little parties are now more important than ever," said Federico Berrueto, the director general of polling firm GCE.
Ranged against the PRI is a bloc of leftist parties that refuse to acknowledge Pena Nieto's victory and the ruling National Action Party, or PAN, of outgoing President Felipe Calderon.
The PAN will insist on concessions in return for its backing although it is in principle supportive of Pena Nieto's plans to overhaul antiquated labor laws, open up state oil giant Pemex to more foreign investment and broaden the tax base.
In the Senate, Pena Nieto will be short of a majority even with the Greens and PANAL. So he knows he cannot avoid negotiating with other parties, a task he also shouldered while governor of the State of Mexico between 2005 and 2011.
But some of the PAN's likely demands, including measures to weaken the power of public sector unions, would put Pena Nieto under pressure inside the PRI, so he will likely seek help from the small parties to minimize his reliance on the PAN.
The PANAL could have 10 seats in the lower house and has signaled it is willing to work with Pena Nieto. The PRI had strong ties with the teachers' union during the 71 years it ruled Mexico before the PAN ousted it in a 2000 election.
But the PANAL's support will not be unconditional.
"We're not going to hand out any blank checks," said Luis Castro, the party's chairman.
The PANAL was created under the auspices of Elba Esther Gordillo, head of the teachers' union and a former PRI grandee who broke with her old party before the last election in 2006.
Renowned as an astute political operator, Gordillo has also been demonized for blocking education reform in Mexico, which analysts say is crucial to shaking up the misfiring economy.
There have been mounting calls for her removal as union leader but Gordillo, 67, has a tight hold on the PANAL and it is very unlikely to cooperate with Pena Nieto if his government tries to force her out. Gordillo's daughter and grandson top PANAL lists of candidates to enter Congress.
Calling Gordillo the most important woman in Mexican politics, Castro said no education reform would be possible without the support of the teachers' union.
"This is the dilemma that Congress faces," he said. "Either there's paralysis, or we broker deals."
Pena Nieto's lot is in sharp contrast to when the president's word was almost law under the PRI - and to how opinion polls long suggested the election would end for him.
For most of the campaign, they forecast Pena Nieto would crush his rivals with between 45 and 50 percent of the vote.
Instead, he won 38.2 percent, weakened in the final weeks by student-led protests against the PRI's past record of corrupt, heavy-handed rule and the 45-year-old Pena Nieto's much publicized ties with Mexico's dominant broadcaster Televisa.
He acknowledged earlier this week he will have to strike deals with rivals to get ahead in Congress. "It is time to agree, not impose," he said. "Time to build, not obstruct."
NEW BALANCE OF POWER
Small parties backed by interest groups have grown in strength, taking advantage of electoral rules that give them a presence in Congress with just 2 percent of the vote.
They also benefit disproportionately from generous public funding of the political establishment.
Lower house deputies are paid more than $11,000 a month plus other congressional allowances, and at federal level parties get more funding to cover expenses like campaigns and research.
In the budget for 2012, the sum earmarked for the Greens, who currently have 22 lower house deputies and six senators, was nearly 479 million pesos ($36 million).
The party did even better in the July 1 election, winning 33 seats in the lower house and nine seats in the Senate as well as its first governorship, in the southern state of Chiapas.
Critics have long dismissed the Greens as a money-making operation for its founders and the group was disowned by its European counterparts in 2009 for running a campaign for the restoration of the death penalty in Mexico.
The party was built up by Jorge Gonzalez and his son Jorge Emilio, who became famous for brushes with scandal, although it insists that the pair are no longer at the helm.
The victories on July 1 have buoyed the party and it is keen to make its mark in the next government.
"We're a crucial part of why Enrique Pena Nieto is going to be president of Mexico," said Greens' Senate leader Arturo Escobar. "We must take advantage of this opportunity to continue justifying our existence in the Mexican political arena."
Many Mexican environmental activists complain that despite its name, the party has failed to advance the ecological agenda, and they accuse it of selling out.
Two of its best known campaign promises were pledging life sentences for kidnappers and medicines paid for by the state.
Detractors saw the pledges as populism and a ruse to benefit drug stores owned by Jorge Gonzalez's extended family. They also accuse both the PRI and the Greens of being too cozy with powerful business interests using the parties for leverage.
Pena Nieto has come under heavy fire for the publicity he received from Televisa in the State of Mexico, and the Greens have notable ties to the other major broadcaster TV Azteca, controlled by Ricardo Salinas Pliego.
Salinas Pliego's daughter is poised to enter the Senate for the Greens, as is another of his executives, who ran on a joint Green Party-PRI ticket in Chiapas.
Carlos Cadena, a former state congressman for the Greens, says his party is being turned into a "business."
One of a group of rebel Greens who campaigned against cooperating with the PRI in the State of Mexico, Cadena said the party must deliver on pledges like making basic environmental education compulsory, or risk being wiped out.
"The Greens are becoming an employment agency for all the PRI people who can't get jobs in the PRI," he said. "The Greens here have really betrayed what was their base."
(Editing by Kieran Murray and Mohammad Zargham)