WHEN he was unexpectedly elected Argentina’s president in 2015 Mauricio Macri faced a task that was about as simple as walking a tightrope across the Iguazú falls while grilling a steak. His predecessor, Cristina Fernández de Kirchner, had bequeathed a make-believe economy. Inflation of 30-40% a year was officially covered up. The peso was wildly overvalued, exports were taxed and many imports were banned. The government provided energy and transport almost free. The resulting fiscal deficit was financed by the central bank, which printed money to the tune of 5% of GDP. In a country traumatised by past economic shocks, Mr Macri promised to straighten all this out gradually.

He has done a pretty good job. The economy has grown at an annual rate of around 3% for the past 18 months, even while the government has ended most of Ms Fernández’s distortions. It has gradually trimmed the fiscal deficit, partly by raising energy and transport prices. The central bank now only hands over money worth 1% of GDP. The government has bought itself time by issuing debt.

The problem is that stabilising the economy is taking longer than the government had hoped and investors have become more reluctant to lend to Argentina. This first became apparent in December, when the government changed its inflation target for this year from 12% to 15%. It put off from 2019 to 2020 its goal of reducing inflation to 5%. The original targets were fixed in 2016 amid much uncertainty. The new ones are supposed to be more realistic. Even so, this year’s target is unlikely to be met. Inflation has run at a rate of 25% over the past 12 months, and the market consensus is that it will end the year at 20%. In hindsight, it might have been wiser to have delayed introducing inflation targets until the economy was closer to being stable. But that is academic.

Fairly or not, the change in the targets hurt the credibility of the central bank. It came as the rise in interest rates in the United States is prompting investors to pull money out of riskier assets. The spread on Argentine bonds (the premium over the yield on United States Treasury bills) has risen from 3.4% to 4.2% this year, and the peso has depreciated steadily. The government responded by saying that it will raise domestically the $8bn it still needs to cover this year’s deficit.

Nevertheless, in the last week of April money flooded out of Argentina. After the central bank spent $4.3bn in five days to prop up the peso, on April 26th it unexpectedly jacked up its minimum interest rate by three percentage points, to 30.25%. This week the peso kept falling; further interest-rate rises may be needed.

It was responding to a fact of political life: Argentines worry even more about the price of the dollar than about inflation. That is why in recent decades the peso has so often been overvalued, killing the competitiveness of many businesses and stunting the country’s exports. It doesn’t help that a severe drought this year has cut exports of soyabeans and maize. A weaker peso will curb the current-account deficit, which has expanded to 5% of GDP. But it will add to the cost of servicing the government’s foreign debt, and in the short term will boost inflation.

The government is trying to control inflation while also trimming the fiscal deficit and keeping the economy growing. Doing all three things at once is hard. For example, eliminating energy and transport subsidies is essential for reducing the fiscal deficit. But hikes in regulated prices added eight points to inflation last year. And the interest-rate rise may dampen growth as well as inflation.

The rise in energy and transport prices has hit the middle class hard (the poor are largely protected). That has taken a toll on Mr Macri’s approval rating, which stands at around 40%, the lowest since he was elected. The rumblings of discontent are starting to alarm his coalition partners. The biggest worry is that stubbornly high inflation expectations will keep inflation from falling, and that only a recession can bring it down to the target level.

April’s rise in regulated prices is expected to be one of the last. Officials are confident that inflation will now start to recede. They are also likely to try to placate investors by slashing non-essential spending in order to lower the primary fiscal deficit (ie, before interest payments) to below this year’s target of 3.2% of GDP.

Even if the economy slows, their calculation is that economic growth and the real value of wages will pick up again next year ahead of a presidential election in October. They are probably right, and Mr Macri still has a good chance of winning a second term. But it is a closer-run thing than it looked a few months ago.