BERLIN — A United Nations court ordered the immediate release Saturday of an Argentine navy training ship held in Ghana two months ago at the request of an American hedge fund.

The ARA Libertad was held Oct. 2 in the port of Tema as collateral for unpaid bonds dating from Argentina’s economic crisis a decade ago. Argentina appealed to the UN’s International Tribunal for the Law of the Sea for the ship’s release, arguing that as a warship the Libertad is immune from being seized.

In an expedited ruling, the court ordered that Ghana “forthwith and unconditionally release the frigate ARA Libertad” and ensure the ship and its crew can leave Ghanaian waters. It also ordered that the vessel should be resupplied as needed.

Detaining the ship was “a source of conflict that may endanger friendly relations among states,” the court said.

The ruling leaves untouched the parties’ rights to seek further international arbitration on the matter.

Argentine Economy Minister Hernan Lorenzino hailed the court’s decision and vowed to continue fighting what President Cristina Fernandez has called “vulture funds,” with whom the country is locked in a series of legal battles.

“Argentina will continue to defend itself from the financial pirates,” Lorenzino said via Twitter on Saturday. “Vultures, you won’t succeed, with the ship nor with the debt.”

Ghana courts ordered the ship detained on a claim by Cayman Islands-based NML Capital Ltd. Its owner, American billionaire Paul Singer, leads a group demanding payment in full, plus interest — about $350 million — for dollar-based Argentine bonds bought at fire sale prices after Argentina’s 2001-2002 economic collapse forced a sharp devaluation of its currency. The vast majority of bondholders accepted about 30 cents on the dollar years ago, and that is roughly what the holdouts led by Singer initially paid for the bonds.

Susana Ruiz Cerutti, the head of Argentina’s sea tribunal, in comments to the Telam state news agency, praised the ruling for being unanimous and for siding with the vessel’s captain, who had been accused of contempt.

It wasn’t immediately clear when the ship would be allowed to set sail. The Director-General of the Ghana Ports and Harbors Authority, Richard Anamoo, told The Associated Press that “it is not the port authorities that are holding the ship. We were only implementing a (Ghanaian) court order.”