Rafael Correa (pictured centre) has his country’s politics firmly under control, its economy much less so

HE MAY be Latin America's least predictable “21st century socialist”, but Rafael Correa seems assured of victory in a presidential election to be held on April 26th. This in itself is an achievement. The general election, held under a new constitution promoted by Mr Correa, comes just 29 months after he was first elected. But no Ecuadorean president has secured a second consecutive term since the 19th century, and none of Mr Correa's three elected predecessors managed to finish their terms. In addition, his Alianza País (Country Alliance) party is likely to gain a majority in the legislature, though it may fare less well in mayoral votes. So the president will probably be in a stronger position to tackle his country's acute financial problems.

How he will do so is hard to say. Mr Correa's portrait, head tilted back like a clean-shaven Che Guevara, is stencilled on election posters all over the country. He claims to lead a “Citizen's Revolution”. Alianza País calls its leadership the politburo, and Mr Correa rages against the World Bank and the IMF.

But unlike Venezuela's Hugo Chávez, a former army officer, or Bolivia's Evo Morales, who is of poor Amerindian origin, Mr Correa is a middle-class economist with a doctorate from the University of Illinois. He can be pragmatic. He has sacked some leftists in his government (though others remain), is friendly to mining companies and is fond of making PowerPoint presentations as the analyst-in-chief.

Mr Correa appears to be uncorrupt. The giant increase in public spending he has overseen (it rose by 71% last year) has resulted in new schools and hospitals. Testing of teachers, with pay linked to results, has been introduced. When talking to an educated audience, Mr Correa stresses the need to improve the country's economic competitiveness.

All this has led some American diplomats to hope that Mr Correa can be detached from the orbit of Mr Chávez. But his anti-Americanism is visceral. His father spent time in an American prison for transporting drugs and committed suicide after returning to Ecuador. President Correa has decided not to renew the lease under which the United States operates drug-surveillance flights from an airbase in Ecuador. In February, he expelled two officials at the American embassy.

Ecuador has enjoyed nine years of economic growth since a financial collapse wiped out its banking system and its currency in 1999 (it adopted the dollar instead). Poverty fell from 52% in 1999 to 35% in 2008. But much of this growth was underpinned by the rise in the price of oil, the main export. Its fall has left Ecuador with a balance-of-payments deficit (see chart).

This has been aggravated by the rise in the value of the dollar in relation to the currencies of Ecuador's neighbours. Mr Correa responded by raising tariffs on hundreds of goods, breaking trade agreements with his Andean neighbours. To make matters worse, remittances from the 2m or so Ecuadoreans living abroad are falling.

The government now faces a fiscal gap of perhaps $2 billion, calculates Margarita Andrade of Analytica Securities, a Quito brokerage. So assuming that he is re-elected, Mr Correa's first task is to ensure that his country does not run out of cash. Where could the money come from? Nobody will buy Ecuadorean bonds for a while. Having announced that two bond issues—those maturing in 2012 and 2030—were “illegitimate” and would not be honoured, the government promptly bought lots of them back at worse-than-junk prices. On April 20th it announced a scheme to buy back the rest at around 30 cents on the dollar.

This might just make it easier for Ecuador to go to the IMF, which requires countries not to be in dispute with bondholders. But Mr Correa has repeatedly lambasted the fund. There are other options. Social-security funds have been raided to prop up the budget. Judging by the brisk demand for safe-deposit boxes in banks, savers are concerned that the government may raid their deposits too.

Various regional lenders will help out before that happens. Ms Andrade reckons that the government could raise up to $500m from the Latin American Reserve Fund and a similar sum from the Inter-American Development Bank. The Andean Development Corporation may provide another $500m.

The government is also talking to China about a cash infusion of $1 billion in exchange for the right to drill for oil, and a $1.7 billion investment in power generation. Even that might not be enough. If the economy worsens, the more impulsive and ideological Mr Correa may overcome the more sensible one. In that case, Ecuador might ditch the dollar and lose its precarious stability.