Buoyed by a growing economy and Venezuelan cash, the Sandinista leader who toppled a dictator is set to win an unconstitutional third term

SPORTING sunglasses and military fatigues, Daniel Ortega's portrait graced thousands of student-bedroom walls in the 1980s. His Sandinista guerrillas overthrew Anastasio Somoza, whose family had run Nicaragua as a private fief for four decades until 1979, and inspired even more support when the United States began an unsuccessful covert war to remove them. Mr Ortega lost power in the country's first-ever free election in 1990, but was voted back into office in 2006. On November 6th he is likely to win another five-year term.

The world's romance with his Sandinista National Liberation Front (FSLN) has soured. Whereas Mr Ortega was once a symbol of victory over tyranny, he is now a cheat. Local elections in 2008 saw vast fraud, with the FSLN wrongly awarded some 40 mayoralties. Foreign donors suspended over $100m in protest. This year the signs are ominous. Voting cards have not been delivered in some areas, and accreditation of opposition parties' agents has been slow. The government has admitted a few EU election monitors, but no independent domestic observers.

Even Mr Ortega's presence on the ballot is disputed. Since presidents are limited to two non-consecutive terms, the incumbent and two-time officeholder is doubly barred. But the Supreme Court gave him the go-ahead in 2009, deciding (on a weekend, when hostile judges were away) that the ban violated his right to equal treatment. Mr Ortega later extended the terms of several of its judges after the legislature could not agree on their successors.

After Fidel Castro, Mr Ortega is the joint-least popular leader in the Americas, according to Latinobarómetro, a regionwide poll. But at home he has more support than ever. Polls give him around half the vote, up from the FSLN's typical 40%. The opposition has formed an alliance against him. But its candidate, Fabio Gadea, a 79-year-old radio journalist, lags behind with about 30%. The FSLN is set to win control of the legislature, and perhaps a constitution-changing supermajority.

The Sandinistas are popular in much of the country. In León, a northern city where the first Somoza dictator was shot dead in 1956, the FSLN's end-of-campaign parade drew thousands. “Daniel is the president of the poor, and Nicaragua is on the up,” says Marco Urroz, a revolutionary veteran who gives tours of a museum showing photos of teenaged compañeros wielding rifles. Rosario Murillo, the first lady and communications minister, has helped transmit this enthusiasm to the 70% of the population that is under 30.

The rhetoric is backed up by an economy that is far stronger than it was during Mr Ortega's first term, when inflation topped 30,000%. Nicaragua is still the poorest country on the American mainland, with an average income of $1,100. But last year it had the fastest growth in Central America after Panama, a feat it may repeat in 2011. Part of the mini-boom is caused by the rising price of food, which makes up a big chunk of Nicaragua's economic output. Mr Ortega has also courted investment with tax breaks and business-friendly regulations that belie his “socialist” brand. Garment factories are moving from Honduras to a Nicaraguan free-trade zone. Call-centres are the next target. And whereas Venezuela has expelled the “imperialist” IMF and World Bank, Nicaragua recently got a friendly write-up from the Fund. The Bank rates it as the Central American country that best protects investors' rights.

The treasury has been helped by Mr Ortega's alliance with Venezuela's president, Hugo Chávez. Nicaragua buys $1 billion a year of Venezuelan oil, and gets half of it back in low-interest, long-term loans. The money is split between investments that range from wind farms to takeovers of troublesome TV channels; subsidies for electricity and transport (a bus ride costs just 11 cents in Managua); and social programmes like Zero Hunger, which gives livestock to poor families. The spending is opaque, and may have favoured FSLN members. But poverty has fallen, and the share of homes with electricity has risen from 55% in 2007 to 70%. Mr Chávez may squirm, but his cash is funding a World Bank-designed update of the land registry.

The opposition calls the Chávez bonus, worth 7-8% of GDP, a form of electoral blackmail. The FSLN likes to hint that it will vanish if anyone else takes power. On October 25th Rafael Ramírez, Venezuela's energy minister, said in Managua that the deal was contingent on continued “revolution”—a heavy hint in favour of the FSLN.

But the bonus may soon evaporate. The ailing health of Venezuela's economy, and of Mr Chávez, has caused Mr Ortega to look for allies in the private sector. Businesses have benefited from the country's macroeconomic stability—and from the government's social spending which, says Manuel Ortega (no relation) of the University of Central America, helps to keep wages low. Campaign finances suggest that companies are supporting the president. Eduardo Montealegre, the runner-up to Daniel Ortega in 2006, says he received $6m in business donations that year. This time Mr Gadea has got less than $1m. Up to September, the FSLN had outspent him by a ratio of over three to one. Pictures of Mr Ortega are all over Managua, but Mr Gadea has just 16 billboards nationwide.

The blurring of the line between the FSLN and the state makes it hard to gauge Mr Ortega's true level of support. At a pro-Sandinista rally in Managua, a group of teenagers declare that they are marching “for the love of the party”. Another young man admits he is there because he fears missing the event would cost him his job in a public hospital. Long lines of people wait in the rain for public buses, which have been diverted to ferry people to the march.

Some predict trouble if Mr Ortega resorts to fraud once again. “In 2008 people were angry and I stopped them burning down the [offices of the] electoral authority,” says Mr Montealegre, who is widely believed to have won Managua's mayoral election that year. “This time, I won't be able to stop anybody.” The government is taking no chances: already, it has put up a steel barricade around the electoral offices, where officials will count, or miscount, the votes. More and more, Mr Ortega's government has a counter-revolutionary feel.