FOR more than a decade Elliott Management, the hedge fund led by Paul Singer, was the pantomime villain in Argentina’s dispute with its bondholders. Rather than accepting a big write-down of debt on which the country had defaulted, as other creditors did in 2005 and 2010, Elliott, along with several other “holdouts”, pursued full payment through the New York courts. That led to a fresh default in 2014.

Now the drama is entering its final act. On February 29th Daniel Pollack, the court-appointed mediator, announced that Argentina had reached an agreement in principle with four of the largest creditors, led by Elliott. Argentina’s payment of $4.65 billion will be 25% less than they were demanding. Even so, it is a big pay-off for investors who bought the debt at a fraction of its face value. With this agreement, Argentina has settled with creditors who hold 85% of the disputed debt.

It is a coup for Mauricio Macri, Argentina’s recently elected president (pictured), and will help end the country’s long isolation from the international credit markets. Together with other steps Mr Macri has taken since assuming office in December, including relaxing exchange controls and removing taxes on some exports, the credit deal helps restore normality to an economy that had been distorted by populist controls during 12 years of rule by his two Peronist predecessors, Cristina Fernández de Kirchner and her late husband, Néstor Kirchner. Addressing Congress, which began its new session on March 1st, Mr Macri blamed his predecessors for Argentina’s weak economy and high inflation. Isolation from credit markets, he declared, had cost the country $100 billion and 2m jobs.

Argentina’s negotiators paved the way back by reaching deals with smaller groups of holdouts. On February 2nd Argentina agreed to pay a group of Italian bondholders $1.35 billion; two weeks later it settled for $1.1 billion with two of the six largest holdouts, Montreux Partners and EM Ltd. But Mr Singer’s Elliott Management led the most intransigent group; an agreement with them is the real prize.

Thomas Griesa, the judge overseeing the case, had contributed greatly to Argentina’s predicament in 2012 when he ruled that the country could not pay bondholders who had agreed to a restructuring, or issue new debt, unless it settled with the holdouts. That precipitated Argentina’s default. On February 19th this year the judge in effect switched sides, saying that Mr Macri’s election had “changed everything”. He said he would lift the injunction barring Argentina from paying other creditors from March 1st under certain conditions. That was a severe blow to the holdouts, who had used the injunction to press Argentina for full payment. “The message to non-settling plaintiffs, many of whom have had no opportunity to negotiate with anyone, is unmistakable: settle by February 29th, or else,” wrote their lawyers.

The deal is not quite sealed. The injunction will not be lifted until Argentina repeals two laws that block agreements with the holdouts. The Ley Cerrojo (Padlock Law), enacted in 2005 during the first round of debt restructuring, was intended to prevent Argentina from offering holdouts a better deal than that accepted by holders of restructured bonds. The Ley de Pago Soberano (Sovereign Payment Law) of 2014 was a failed attempt to circumvent Mr Griesa’s injunction by re-routing payments to bondholders who had accepted a deal through Argentina or France.

Opening the lock

The government is confident that it can secure the votes in Congress to repeal the laws. In early February, 13 deputies from the Front for Victory (FPV), Ms Fernández’s party, broke away to form a more moderate “Justicialist Bloc”. The move deprived the FPV of its position as the largest grouping in the lower house. The defectors have said they are willing to work with the new government to repeal the laws. In the upper house the government plans to enlist the support of Peronist governors, who are also keen to tap international credit markets. They are likely to persuade the senators over whom they have influence to support the repeal of the legislation.

Once the laws have been scrapped, the government hopes to raise up to $15 billion through a bond issue, which it will use to pay the creditors. Some analysts doubt that the market can absorb such a large sum. But Argentina’s finance secretary, Luis Caputo, is bullish. “All the banks we’ve spoken with are confident that we can raise the money we need in the market,” he said.

The government then plans to return to the market in an effort to finance its budget deficit, which was a daunting 5.8% of GDP last year. Under Ms Fernández’s administration the central bank financed the deficit by printing money, pushing up inflation. The bond issue will help the central bank to end that harmful practice, but the relief from high inflation will not come immediately. Propelled by the devaluation of the peso, the annual inflation rate, already high, has risen to around 30%; the government had hoped inflation this year would be 20-25%. It is trying to persuade trade unions not to demand excessive wage rises, which would drive inflation even higher. The unions are unwilling to make sacrifices, however. On February 25th teachers extracted an agreement from the government for a 30% salary increase; other unions are demanding pay rises at least as big.

Mr Macri has so far taken a cautious approach to bringing down the budget deficit. Energy subsidies have been cut, but the president is reluctant to slash other spending, which would further rile Argentines already angry about inflation and, he fears, would weaken growth and employment. But until the government brings the deficit substantially down, the central bank will struggle to regain credibility. A return to the bond markets is not enough.

Nevertheless, the debt deal should boost the government’s confidence. It has until April 14th to repeal the legislation and pay Elliott and its fellow litigators. It must also settle with the holders of the remaining 15% of the debt. But the exhausted negotiators are allowing themselves a moment of satisfaction. “It seemed like a thousand years to me,” Mr Pollack said of the seemingly interminable talks. Mr Macri hopes not to take up much more of his time.