Eurozone finance ministers have agreed a 10bn-euro bailout deal for Cyprus to prevent its banking system collapsing and keep the country in the eurozone.
Laiki (Popular) Bank – the country’s second-biggest – will be wound down and deposit-holders with more than 100,000 euros ($130,000; £85,000) will face big losses.
However, all deposits under 100,000 euros will be “fully guaranteed”.
The European Central Bank had set a deadline of Monday for a deal.
Laiki will be split into “good” and “bad” banks, with its good assets eventually merged into Bank of Cyprus.
The president of the Eurogroup of eurozone finance ministers, Jeroen Dijsselbloem, told a press conference in Brussels the deal had “put an end to the uncertainty” around Cyprus’s economy.
He added he was “convinced” the new deal was better for the Cypriot people than the broader measure rejected by the Cypriot parliament last week, as it focused on two problem banks rather than the entire sector.
IMF head Christine Lagarde said the deal was “a comprehensive and credible plan” to help restore trust in the banking system.
Cypriot Finance Minister Michalis Sarris said he believed the possibility of bankruptcy had been averted.
“It’s not that we won a battle, but we really have avoided a disastrous exit from the eurozone,” he said.
The deal is being seen as good news by many of Cyprus’s small account-holders who have been protected. But officials acknowledge that Cyprus will enter a deep recession and that it will take years to recover, BBC Europe correspondent Chris Morris says.
Many businesses will suffer or shut down, he says.
Under the deal all deposits under 100,000 euros will be secured.
The percentage to be levied on large deposits in the Bank of Cyprus will be resolved in the coming weeks, Mr Dijsselbloem said.
One key element of the deposit tax, demanded by the IMF, is that it should not require approval by the Cyprus parliament.
EU Commissioner for Economic Affairs Olli Rehn said that the “depth of the financial crisis in Cyprus means that the near future will be difficult for the country and its people”.
Asian financial markets rose in early trading on news of the deal.
The deal came after hours of tense negotiations between Cypriot President Nicos Anastasiades and the “troika” of EU, European Central Bank and IMF leaders.
Mr Anastasiades had reportedly asked the heads of the troika if they wanted him to quit.
“Do you want to force me to resign?” Cyprus News Agency quoted him as saying, citing sources at the presidential palace.
“I am giving you one proposal, and you do not accept it. I give you another and it’s the same. What else do you want me to do?” he was quoted as saying.
In another development on Sunday, Bank of Cyprus – the island’s biggest lender – further limited cash machine withdrawals to 120 euros a day.
With queues growing outside cash machines across the island, the second biggest lender, Laiki, also lowered its daily limit to 100 euros, Cyprus News Agency reported. The bank’s previous limit had been 260 euros per day.
Banks have been closed since last Monday and many businesses are only taking payment in cash.
Mr Dijsselbloem said that the details of the re-opening of Cyprus’ banks would be discussed on Monday by the Cypriot government and the troika.
Parliament rejected a bank levy on small and large deposits earlier this week. The levy that was rejected would have taken 6.75% from small savers and 9.9% from larger investors. It caused widespread anger among ordinary savers.
The European Central Bank (ECB) had said it would cut off funds to the banks by Monday unless a new deal was reached.
There is concern on the Mediterranean island that a levy on large-scale foreign investors, many of whom are Russian, will damage its financial sector.
Correspondents say Germany has pushed hard for a levy on investors who have benefited from high interest rates in recent years, rejecting a Cypriot plan to use money from pension funds.
Cypriot Finance Minister Michael Sarris recently travelled to Moscow in an unsuccessful attempt to get Russian help.
On Saturday afternoon more than 1,000 bank employees marched to the Cypriot finance ministry, stopping briefly at the presidential palace.