* Deal to shut Laiki bank, transfer insured deposits
* Clinched hours before Monday deadline to seal EU bailout
* Without deal banks faced collapse, possible euro zone exit
Cyprus reached a last-ditch deal with international lenders on a 10 billion euro ($13 billion) rescue plan to avoid economic meltdown, agreeing to close down its second-largest bank and inflict heavy losses on big depositors.
The agreement came hours before a deadline to avert a collapse of the banking system in fraught negotiations between President Nicos Anastasiades and heads of the European Union, the European Central Bank and the International Monetary Fund.
Without a deal, Cyprus's banking system would have collapsed and the country could have become the first to crash out of the European single currency.
Backed by euro zone finance ministers, the plan will spare the Mediterranean island a financial catastrophe by winding down the largely state-owned Popular Bank of Cyprus, also known as Laiki, and shifting deposits below 100,000 euros to the Bank of Cyprus to create a "good bank".
Deposits above 100,000 euros in both banks, which are not guaranteed under EU law, will be frozen and used to resolve Laiki's debts and recapitalise Bank of Cyprus, the island's biggest, through a deposit/equity conversion.
The raid on uninsured Laiki depositors is expected to raise 4.2 billion euros, Eurogroup chairman Jeroen Dijssebloem said.
Laiki will effectively be shuttered, with thousands of job losses. Officials said senior bondholders in Laiki would be wiped out and those in Bank of Cyprus would have to make a contribution.
An EU spokesman said no across-the-board levy or tax would be imposed on deposits in Cypriot banks, although the hit on large account holders in the two biggest banks is likely to be far greater than initially planned. A first attempt at a deal last week collapsed when the Cypriot parliament rejected a proposed levy on all deposits.
It was unclear if banks would reopen for business on Tuesday, but an announcement, if any, was anticipated to be accompanied by restrictions on capital movements to prevent a run on banks.
Cyprus government spokesman Christos Stylianides said: "We averted a disorderly bankruptcy which would have led to an exit of Cyprus from the euro zone with unforeseeable consequences."
Asked about the level of losses on uninsured depositors in Bank of Cyprus, he told state radio: "The assessment is that it will be under or around 30 percent."
The Cyprus central bank said the agreement had also avoided the disorderly default of Laiki Bank.
Russia signalled it would back the bailout even though it would impose big losses on Russian depositors, who have billions in Cyprus banks.
President Vladimir Putin ordered officials to restructure a loan Moscow granted to Cyprus in 2011 - having rejected Nicosia's request for easier terms in crisis talks last week.
Prime Minister Dmitry Medvedev - who ranks below Putin - earlier criticised the bailout, voiced the anger expressed by Russian depositors, saying: "The stealing of what has already been stolen continues."
Among Cypriots, there was a mood of wariness about the deal.
"How long will it last?" asked Georgia Xenophontos, 23, a hotel receptionist in Nicosia. "Why should anyone believe anything this government says?"
But many in the capital appeared intent on enjoying a sunny holiday morning, drinking coffee at pavement cafes and watching camera crews filming people drawing money from bank machines.
German Chancellor Angela Merkel said the deal was right for Cyprus because it ensured that those who contributed to the crisis were required to pay towards its resolution.
"I am very pleased that a solution was found last night and that we have been able to avoid an insolvency," Merkel said.
Anastasiades is expected to make a live televised statement at 1700 GMT, after his return to Cyprus from Brussels.
Lefteris Christoforou, vice-chairman of the ruling Democratic Rally party, said it was important that Cyprus had avoided a chaotic bankruptcy. "It is a bad deal, but the extreme scenario we had to contend with was worse."
A senior source in the Brussels talks said Anastasiades threatened to resign at one stage on Sunday if pushed too far.
The Conservative leader, barely a month in office and wrestling with Cyprus's worst crisis since a 1974 invasion by Turkish forces split the island in two, was forced to abandon his efforts to shield big account holders.
Diplomats said the president had fought hard to preserve the country's business model as an offshore financial centre drawing huge sums from wealthy Russians and Britons but had lost.
The EU and IMF required that Cyprus raise 5.8 billion euros from its banks towards its own rescue in return for 10 billion euros in international loans. The head of the EU rescue fund said Cyprus should receive the first emergency funds in May.
IMF chief Christine Lagarde said the agreement was "a comprehensive and credible plan" that addresses the core problem of the banking system.
"This agreement provides the basis for restoring trust in the banking system, which is key to supporting growth," she said in a statement.
With banks closed for the last week, the Central Bank of Cyprus imposed a 100-euro daily limit on withdrawals from cash machines at the two biggest banks to avert a run.
The euro gained against the dollar on the news in early Asian trading.
Analysts had said failure to clinch a deal could have caused a financial market sell-off, but some said the island's small size - it accounts for just 0.2 percent of the euro zone's economic output - would have limited contagion.
Cyprus's banking sector, with assets eight times the size of the economy, has been crippled by exposure to Greece, where private bondholders suffered a 75 percent "haircut" last year.
Without a deal by the end of Monday, the ECB said it would have cut off emergency funds to the banks, spelling certain collapse and potentially pushing the country out of the euro.
Under the bailout agreement, Laiki's ECB funds will pass to Bank of Cyprus, and the central bank will "provide liquidity to BoC in line with applicable rules".
The tottering banks held 68 billion euros in deposits, including 38 billion in accounts of more than 100,000 euros - enormous sums for an island of 1.1 million people that could never sustain such a big financial system on its own.