Iceland has won a court ruling allowing it to repay billions of euros on its own terms to Britain and the Netherlands for bailing out depositors in a failed Icelandic bank.

Iceland has said it will fully repay both countries, but through a gradual process as it runs down the assets of failed bank Landsbanki.

It collapsed in 2008 leaving depositors of its Icesave online accounts stranded.

Britain and the Netherlands stepped in to repay savers, but it sparked a political row and the two countries sought court backing to say Iceland had failed to repay the money within time limits set by a European directive for deposit guarantee schemes.

A European court has now dismissed the case.

Officials on the small north Atlantic island expressed relief over the ruling.

"Icesave is now no longer a stumbling block to Iceland's economic recovery," Iceland's Foreign Ministry said.

All of Iceland's banks collapsed four years ago, early in the financial crisis, and the UK and Dutch governments wanted Iceland to pay them back directly and quickly.

Iceland did not comply, triggering a row between the governments and potentially complicating the island's bid to join the European Union.

The court of the European Free Trade Association said Iceland did not break depositor protection laws by refusing to return the money, because the scale of its financial crisis was so big.

"The verdict is, of course, a fantastic and total victory for us," said Icelandic Industries Minister Steingrimur Sigfusson, who was finance minister during the dispute.

"It's good to have this whole unpleasant business out of the way," he said in comments on public broadcaster RUV.

Iceland's economy sank and the government had to take a bailout from the International Monetary Fund and Nordic countries after the 2008 crisis.

The row with the British and Dutch over the Icesave accounts added to bitterness in the aftermath of the crisis, when Iceland was especially angered at Britain's use of anti-terrorism legislation to freeze Landbanki assets.

Britain had no immediate reaction to the verdict. The Dutch Finance Ministry said in a statement that it "regrets the judgment and will study the consequences of the judgment".

The European Commission had also pressed the case against Iceland and said it was also studying the consequences.

Icelanders in referendums twice voted against repayment schemes drawn up by their government to satisfy the British and Dutch claims, leaving the estate of Landsbanki to pay back the funds, which it has steadily done.

The court of EFTA, a cooperation group of which Iceland is a member and that has links to the European Union, rejected all three claims brought by the EFTA Surveillance Authority, which is the body that oversees the bloc's rules.

In its ruling, the court said the deposit guarantee directive in place in 2008 did not envisage the obligation to repay savers in Britain and the Netherlands "in a systemic crisis of the magnitude experienced in Iceland".

The Icelandic Foreign Ministry said 585 billion Icelandic crowns of the 1,166 crowns of claims from Icesave had been repaid from the failed Landsbanki estate, representing more than 90% of the minimum deposit guarantee covering the savers.

"It is expected that the Icesave claims will be paid out in full by the actual debtor, the estate of the failed Landsbanki," the Foreign Ministry said.