AFTER five years in the wilderness, Venezuela's opposition is back in parliament and in contention. By winning 65 seats in the 165-member, single-chamber National Assembly, in an election on September 26th, the Venezuela Unity coalition dealt a blow to the hopes of Hugo Chávez, the leftist president, of exercising indefinite hegemony. Even worse for the president and his claim to be leading a popular revolution was the fact that the overall vote of 5.4m for the ruling United Socialist Party (PSUV) and its communist allies, was just below that of their opponents (5.7m).

Only blatant gerrymandering of constituencies and an electoral reform that abolished proportional representation allowed Mr Chávez to keep control of the legislature. Even so, he failed to retain the two-thirds majority he had said was vital for his regime's future. Without it, the government must negotiate appointments to key posts, such as supreme court justices and members of the electoral authority (the CNE). And it cannot pass, or amend, laws which affect constitutional rights. Particularly irksome will be the fact that it may not be able to muster the 99 deputies required to authorise Mr Chávez to rule by decree, as he has been wont to.

In his 11 years in power Mr Chávez has profited from the opposition's mistakes, which have included an attempted coup in 2002 and an ill-judged boycott of the previous legislative election in 2005. Over that period he has won a dozen national votes (the only exception being a constitutional referendum in 2007). The opposition's rehabilitation began with a strong showing in big cities in a regional vote two years ago. For the legislative election, its multitude of constituent groups managed to hammer out a united front. Their success increases the chance that they will unite behind a single candidate against Mr Chávez in the presidential election that is due in two years' time.

Having campaigned as if the assembly election were a plebiscite on his rule, Mr Chavez this week said it was “not about me”. He claimed a “solid victory”, arguing that the 3.2% of the vote won by a party of moderate chavista dissidents (whom he had earlier denounced as “traitors”) should not be counted with the opposition. He promised to “end 2010 at a gallop” and to continue “building socialism”.

On paper, he has the means to press ahead. The outgoing assembly will have free rein to rewrite rules until the end of the year. Thereafter Mr Chávez will still control the courts, the armed forces, the all-important oil industry and other state bodies. If the new assembly becomes deadlocked—for example, over the appointment of new members to the CNE—he may use the supreme court to bypass it.

Will sticking to his course allow him to recover enough votes to win a third consecutive six-year term in December 2012? He will have his work cut out. He has lost ground in urban Venezuela. In some poorer districts that are traditional PSUV strongholds, it was hard to find a single chavista voter on election day. In greater Caracas, the opposition won over 860,000 votes to the PSUV's 634,000.

Just 24 hours after the polls Mr Chávez announced a new billion-dollar fund to build houses in the capital. But the electorate has grown used to unfulfilled promises. The housing shortage has worsened every year since he took office in 1999. Crime is at record levels, the economy in recession and food prices are rising at over 40% a year. Public services such as water, electricity and health care are close to collapse in many areas.

The good news for Venezuela is that representative democracy—which Mr Chávez promised to replace with a “participatory” version—is still alive. Turnout was 66%, and there were few claims of irregularities. Although there was a delay of a few hours in announcing the results, when they came neither side challenged them. Those in the opposition who maintain that voting is a waste of time continue to mutter on the sidelines but these days fewer people are listening. Even the brazen use of government resources, voter intimidation and other dubious tactics failed to produce the result the president wanted.

Mr Chávez had called on his followers to “demolish” the opposition. Instead, it has emerged stronger than at any time in the past decade. Its next job will be to come up with a plausible presidential candidate, capable of communicating with ordinary Venezuelans. But with the country split down the middle, a pluralist parliament could promote the understanding and dialogue that Venezuela sorely needs. Whatever the president's wishes, demolition seems to be off the agenda.