Image copyright Getty Images Image caption Argentina's president Mauricio Macri

Argentina has signed an agreement with US hedge funds to settle a protracted dispute over its failure to repay billions of dollars worth of bonds.

It will pay the funds who sued the nation about $4.6bn to settle claims.

They had bought the bonds at heavily discounted prices after the country's economy collapsed in 2001.

The previous government of President Cristina Fernandez de Kirchner, refused to negotiate with the investors, labelling them "vulture funds".

Repeal needed

The agreement is a victory for Mauricio Macri, who was sworn in as Argentina's president in December.

He reversed the non-payment stance taken by his predecessor.

Daniel Gallas, BBC South America Business Correspondent, said there was still a lot of work to be done.

He said that after winning over the hedge funds Mr Macri must now convince his own congress that this is a good deal for the country.

"The previous administration of Cristina Fernandez de Kirchner had approved a 'lock law' which forbids Argentina from paying out hedge funds in the terms that were negotiated today," he said.

"If Mr Macri is to deliver on his promise to get Argentina borrowing internationally again, he must get politicians to repeal that law."

Analysis: Veronica Smink, BBC Argentina

If Argentina finalizes a deal with hostile funds NML and Aurelius Capital it would force the remaining holdouts to negotiate and could mean the end of a 15 year battle that turned the country into a pariah of the international markets.

While its Latin American neighbours have had access to credit at around 5% interest rates, Argentina had been forced till now to pay at least double, leaving the country without much needed financial help.

An agreement would also pave the way for future international investment, as it would create confidence in the country and its adherence to the rule of law.

But the deal will also have a political cost for president Mauricio Macri, as the fight against the "vulture funds" - as they are called locally - is considered a matter of national pride by many, who applauded previous president Cristina Kirchner's stand against them.

The creditors were led by hedge funds NML Capital and Aurelius Capital Management.

Daniel Pollack, the court-appointed mediator, said: "It gives me greatest pleasure to announce that the 15-year pitched battle between the Republic of Argentina and Elliott Management, led by Paul Singer, is now well on its way to being resolved."

The long-standing dispute has restricted the country's access to international credit markets.

After the announcement was made the Buenos Aires Stock Exchange's benchmark Merval Index was up by 3%.