Details of how Greece will restructure its massive debts have emerged as eurozone leaders agree a package they hope will help resolve the debt crisis.

Private lenders will be forced to contribute to the aid package which is designed to give Greece decades more to repay its debts.

It comes after leaders agreed to lend Greece a further 109bn euros ($155bn, £96.3bn).

Asian stock markets reacted quietly to the news, while the euro held gains.

Japan's Nikkei index rose 1.2% in late afternoon trading, while the Hang Seng was up 1.5%. US stocks closed up 1.2% on Thursday, while European markets rallied strongly in anticipation of the deal.

The share prices of banks seen as most exposed to distressed eurozone government debts rose by more than 5%, led by Barclays, which ended the day 7.8% higher.

Meanwhile, the euro stayed near a two-week high against the dollar, reached as news of the agreement broke.

Doubts will remain as to whether, having won a second bailout, Greece will remain committed to unpopular austerity measures and privatisations Europe's big deal

The latest Greek bailout by the 17 eurozone governments and the International Monetary Fund is part of a comprehensive package to shore up the single currency unveiled on Thursday.

Eurozone leaders hailed the comprehensive agreement.

Dutch Prime Minister Mark Rutte said: "We have thus sent a clear signal to the markets by showing our determination to stem the crisis and turn the tide in Greece, thereby securing the future of the savings, pensions and jobs of our citizens all over Europe."

Debt relief

The Institute of International Finance - a global trade body representing big banks and other major lenders - said the planned debt restructuring would target participation by 90% of Greece's private sector lenders.

French President Nicolas Sarkozy said private lenders will contribute a total of 135bn euros of financing to Greece.

The plan is expected to provide some 50bn euros of debt relief to Greece.

Three of the four options offered to lenders to swap or relend existing debts would extend Greece's repayment terms by 30 years, while the fourth would do so by 15 years.

They all offer a much lower interest rate than Greece's current 15%-25% cost of borrowing in financial markets.

Two of the options would also involve "haircuts" - reducing the principal amount of debt Greece has to repay.

The terms of the deal imply a loss to Greece's lenders equivalent to 21% of the market value of their debts, said the IIF.

First default

The restructuring is widely expected to be declared by credit rating agencies to be a default by Greece on its debts - something European leaders have been at pains to avert until now.

Media playback is unsupported on your device Media caption Herman Van Rompuy: "This situation was... threatening the stability of the eurozone"

The ECB and France had been particularly opposed to a default, but it was ultimately insisted on by Germany.

German Chancellor Angela Merkel said: "I strongly welcome the voluntary contribution from the banks. I believe that this is the right signal coming at a difficult time".

Mr Sarkozy played down the significance of the banks' participation in the aid package.

"If the rating agencies are using the word you just used (default), it is not part of my vocabulary. Greece will pay its debt," he told reporters.

The deal would make Greece the first ever EU country to default, and could have a number of serious repercussions:

banks would be forced overnight to recognise in their financial accounts billions of euros in losses on Greek debts they own

these losses could in turn leave banks short of capital - making it difficult for them to lend - and could leave the Greek banks insolvent

Greek banks would also be unable to use their government's debts as security to borrow cash from the ECB

the ECB itself stands to make major losses on Greek debts it has bought or accepted as collateral from the Greek banks

separately, the debt restructuring could also trigger payouts on billions of dollars of credit derivative contracts, used by financial markets to hedge against or speculate on a Greek default

The Greek bailout package will be used to soften the blow to the Greek banks, with 20bn euros being used to recapitalise them, and 35bn euros to facilitate their continued borrowing from the ECB.

Irish interest rates

The biggest fear of European leaders is that imposing losses on Greece's lenders could lead to contagion - a sharp increase in the rate at which markets are willing to lend to other eurozone borrowers, in particular Italy and Spain.

Debt to GDP ratios Greece 142.8%

Italy 119%

Belgium 96.8%

Ireland 96.2%

Portugal 93%

Germany 83.2%

France 81.7%

Spain 60.1% Source: Eurostat. Government debt expressed as a percentage of economic output.

"We would like to make it clear that Greece requires an exceptional and unique solution," the eurozone leaders said in a statement following their meeting.

Despite their fears, markets rallied as details of the new bailout emerged, with the cost of borrowing for all of Europe's heavily indebted borrowers falling.

However, the borrowing costs of Portugal and the Republic of Ireland still remain at levels that suggest markets think they too are likely to default in the next five years.

Mr Sarkozy said on Thursday there will be no imposition of losses on private sector lenders to the Irish Republic or Portugal.

Thursday's announcement should make life easier for both countries, with the repayment dates of their rescue loans being doubled to 15 years.

It also included a 2% reduction in the Irish Republic's interest payments, something that the Republic's Prime Minister, Enda Kenny said would save it a "substantial" 600-800m euros a year.

Investment projects

Among the other changes announced on Thursday were plans to ultimately turn the Eurozone's bail-out fund into a European equivalent of the IMF.

The EFSF was granted new powers to buy up bonds - necessary for it to carry out the Greek debt restructuring - and to make credit available to countries such as Spain and Italy that are not at immediate risk of insolvency.

EU development funds and loans from the European Investment Bank would be used to finance Greek infrastructure and development projects.

The move responds to criticisms from some economists that the eurozone's previous approach of insisting that Greece implement deeper and deeper budget cuts was killing the Greek economy, and therefore self-defeating.

European Commission President Jose Manuel Barroso also indicated plans to rein in the power of the credit rating agencies.

"We... endorsed the plan of reducing overreliance on external credit ratings," he said, adding that policymakers would come forward in the autumn "with further proposals".