THE mosquito-infested jungle near the mouth of the San Juan river seems of little value. But to Daniel Ortega, who in a year's time plans to seek a third, unconstitutional, term as president of Nicaragua, the sticky marshland is proving useful. The right bank of the river marks Nicaragua's border with Costa Rica. The two countries have squabbled over navigation rights for more than a century. But last month Nicaragua went further: a group of Nicaraguans dredging the river set up camp on the Costa Rican side, backed by about 50 soldiers. That prompted Costa Rica to send 70 police to the border and to call in the Organisation of American States to mediate (it wants both sides to withdraw and talk).

The leader of the dredging party, Edén Pastora, is an eccentric former Sandinista guerrilla leader, who claimed that Google Maps showed his camp to be in Nicaraguan territory. Google then admitted to an “inaccuracy” in its map, adding that these should not be relied on to make military decisions. But Mr Ortega has enjoyed a wave of nationalist support at home. On November 3rd he won the first unanimous vote in the National Assembly of his four years in office. All this coincides with the start of the election campaign.

Nicaragua's constitution limits presidents to two non-consecutive terms. Having previously served from 1985 to 1990, during the Sandinista revolution which toppled the Somoza dictatorship, Mr Ortega is doubly barred from running again. Mimicking his Venezuelan ally Hugo Chávez, he has tried to abolish term limits. When the required 60% majority in parliament proved elusive, he appealed to allies in the Supreme Court, who ruled that the re-election ban violated his human rights. Mr Ortega has since illegally extended the terms of these justices. To justify this, leaders of his Sandinista Party ordered the printing of a rewritten (but bogus) constitution during a public holiday in September. The electoral authority, also illegally stuffed with allies, has accepted Mr Ortega's candidacy, which is celebrated in roadside billboards lit with pink neon.

The president will be difficult to unseat. Although his trampling of the constitution has prompted a cut in Western aid, donations from Mr Chávez, said to amount to some $400m a year, have more than offset this loss. With these funds, which are managed through a private company, Mr Ortega has won support with giveaways of zinc roofing material, livestock and the like, as well as cheap bus fares.

A few blocks from the National Assembly, a squalid shantytown is being replaced by neat concrete houses for the poor, many of which display the black and red flags of the Sandinista Party in their porches. Backing the party is rewarded: some 18,000 public servants have been replaced by party loyalists, according to Vilma Núñez of the Nicaraguan Centre for Human Rights, an NGO.

The opposition, split three ways in the 2006 vote, has recently lighted on a possible unity candidate. Fabio Gadea, a well-known conservative radio journalist, is pushing 80 but is popular in the rural areas that the opposition has previously struggled to win. After only a few weeks he has captured a quarter of the vote, polls suggest. He has yet to gain the backing of Arnoldo Alemán, a former president convicted of corruption who seems determined to stand. Currently polling just 7%, Mr Alemán is under pressure from some in his own Constitutional Liberal Party to step down to give Mr Gadea a clear run. Many suspect him of holding out for a deal with Mr Gadea, or indeed with Mr Ortega, with whom he has made clandestine power-sharing pacts in the past.

Mr Gadea is still light on policy, beyond denouncing Mr Ortega's constitutional manoeuvres. His advisers insist, perhaps implausibly, that they can match the FSLN's spending programmes even without Venezuelan aid, by cutting out corruption and inefficiency. Though the restoration of the rule of law would bring in more private investment in the long run, the short run counts in mainland Latin America's poorest country, where income per head is $3,000 a year. Polls have Mr Ortega on over 40%, an improvement on his winning tally of votes four years ago.

He is taking no chances. Police commanders have been replaced with Sandinista loyalists; the police chief is widely respected but her term will end in September, before the election. The army is being subtly courted, with ministerial positions for former generals.

Ms Núñez says that dissenters are menaced by the “Councils for Citizen Power”, outfits made up of Sandinista militants and hired thugs. Her own home has been attacked, perhaps because she acted as a lawyer for Mr Ortega's adopted stepdaughter, Zoilamérica, who claimed in the 1990s that Mr Ortega sexually abused her during her childhood. (No charge was brought: Mr Ortega's Assembly membership granted him immunity and the statute of limitations had expired.) “He says he is continuing the revolution,” says Ms Núñez, who was a political prisoner under the Somoza dictatorship. “But it's not the revolution I was part of. He is an impostor.”