Iceland has reached a deal aimed at settling the Icesave banking dispute with the UK and Netherlands.
Its government has agreed to pay back the estimated 4bn euros (£3.4bn; $5.3bn) the UK and Dutch governments spent reimbursing citizens who lost money in the collapse of Icesave.
Repayments will begin in 2016 and will be completed by 2046.
The terms of the agreement must now be approved by Iceland's parliament and president.
The UK Treasury welcomed the deal.
"Mutually satisfactory closure of this issue will mark a new chapter in UK-Iceland relations," it said.
The UK recently changed its stance over Iceland's wish to join the European Union and stopped opposing the plan.
Speaking before the agreement was announced, the Chancellor, George Osborne, said he thought this had had a big influence on the decision.
"I think this has led to a much more constructive relationship between the Icelandic government and the British Government, which was pretty glacial, frankly," he said.
Representatives of the three countries met in London to agree the final terms of a deal.
Negotiations over the repayments have been going on for the past two years, since Icesave's parent company, Landsbanki, collapsed at the end of 2008.
Iceland will pay an interest rate on its outstanding debt of 3% to the Dutch and 3.3% to the UK from 2011.
Those terms are better than a previous deal, subsequently voted down by Icelandic voters in a referendum, which included an interest rate of 5.5%.
Lee Buchheit, a US lawyer who led Iceland's negotiating team, said the different interest rates for the UK and the Netherlands reflected the differing amounts the two countries had to pay to raise funds on the open markets.
"The negotiations focussed from our side on trying to identify a cost of funds rate," he told reporters.
"It was our view that this situation was one of mutual distress, everyone is to some degree to blame for it.
"No-one should be seeking to make any money on the transaction," he said.
The Netherlands will receive 1.3bn euros, the Dutch finance ministry said in a statement.
The UK government put more than £2bn into the Financial Services Compensation Scheme to cover Icesave account holders.
Mr Buchheit said the indications were that the bulk of the debt, excluding interest payments, would be covered by the sale of the assets of Landsbanki.
The issue of repayments created a diplomatic row between Iceland and the UK, as well as political controversy in Icesave's home country.
The then UK Prime Minster Gordon Brown accused his Icelandic counterpart of "unacceptable" and "illegal" behaviour after Iceland said it could not give a guarantee to reimburse UK customers of the online bank.
In response, Icelandic PM Geir Haarde accused the UK government of "bullying" and bringing down one of its other banks after the Treasury froze the assets of Icelandic institutions in the UK.
Iceland was plunged into a deep recession following the collapse of its leading banks, including Icesave's parent company Landsbanki, in 2008.
Voters angry at having to pay for the failures of the country's financiers and politicians had rejected the terms of an earlier Icesave repayment deal in a referendum in March this year.