BRUSSELS - Cyprus secured a package of rescue loans in tense, last-ditch negotiations early Monday, two EU diplomats said, saving the country from a banking system collapse and bankruptcy.

The cash-strapped island nation needs a 10 billion euro ($13 billion) bailout to recapitalize its ailing lenders and keep the government afloat. The European Central Bank had threatened to cut crucial emergency assistance to the country's banks by Tuesday without an agreement.

The finance ministers of the 17-nation eurozone accepted the plan reached in 10 hours of negotiations in Brussels between Cypriot officials and the so-called troika of creditors: the International Monetary Fund, the European Commission and the ECB.

Under the plan, Cyprus' second-largest bank, Laiki, will be restructured and holders of bank deposits of more than 100,000 euros will have to take losses, the diplomats said. They spoke on condition of anonymity pending the official announcement. It was not immediately clear whether the holders of large deposits in the remaining Cypriot banks would equally be forced to take losses.

The diplomats also did not elaborate on how much large deposit holders would lose. Making them take a hit is expected to net several billion euros, reducing the amount of rescue loans the country needs.

Without a deal by Monday night, the tiny Mediterranean island nation of about 1 million would have faced the prospect of bankruptcy, which could force it to abandon the euro currency and spur turmoil in the eurozone of 300 million people.

To secure a rescue loan package, Nicosia had to find ways to raise 5.8 billion euros so it could qualify for the 10 billion euro bailout package. The bulk of that money is now being raised by forcing losses on large deposit holders as well as bond holders in Laiki bank, which will be split into a bad bank of toxic assets and a remaining viable core business.

But Cyprus resisted pressure by creditors to also unwind the country's largest lender, Bank of Cyprus, the diplomat said.

A plan agreed to in marathon negotiations earlier this month called for a one-time levy on all bank depositors in Cypriot banks. But the proposal ignited fierce anger among Cypriots because it also targeted small savers. It failed to win a single vote in the Cypriot Parliament.

Under the new agreement, average savers' deposits with all Cypriot banks of up to 100,000 euros will be guaranteed by the state in accordance with the EU's deposit insurance guarantee, the diplomat said.

In an illustration of the depth of the fear of a banking collapse, Cyprus' central bank on Sunday imposed a daily withdrawal limit of 100 euros ($130) from ATMs of the country's two largest banks to prevent a bank run by depositors worried about their savings.

Cypriot banks have been closed this past week while officials worked on a rescue plan, and they are not due to reopen until Tuesday. Cash has been available through ATMs, but long lines formed and many machines have quickly run out of cash.

The international creditors, led by the IMF, were seeking a fundamental restructuring of the outsized financial system, which is worth up to eight times the country's gross domestic product of about 18 billion euros. They say the country's business model of attracting foreign investors, among them many Russians, with low taxes and lax financial regulation has backfired and must be upended.

They also insisted that Cyprus couldn't receive more loans because that would make its debt burden unsustainably high.

After the eurozone's finance ministers' approval, the ECB is expected to continue providing liquidity to the Cypriot banks, avoiding an imminent collapse. Several national parliaments in eurozone countries such as Germany then must also approve the bailout deal, which might take another few weeks.

___

Associated Press writers Elena Becatoros and Menelaos Hadjicostis in Nicosia, Cyprus, contributed to this story.

______

Don Melvin can be reached at https://twitter.com/Don_Melvin.

Juergen Baetz can be reached at http://www.twitter.com/jbaetz

Related on HuffPost:

Loading Slideshow...
  • Cypriots show their palms reading 'No' during a protest against an EU bailout deal outside the parliament in Nicosia on March 18, 2013. Cyprus's parliament has postponed until March 19 a session to vote on the bailout deal that slaps a levy on all Cypriot bank savings, as negotiators scrambled to soften the blow for small deposit holders. AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • Cypriots protest outside the parliament building in Nicosia, on March 18, 2013. Cyprus President Nicos Anastasiades was seeking the backing of MPs for an EU bailout deal that slaps a levy on bank savings under harsh terms that have jolted global markets and raised fears of a new eurozone debt crisis. AFP PHOTO /PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • Euro coins from Cyprus, center, surrounded by coins from other Euro zone countries, are displayed in a coin collectors' shop window in downtown Lisbon, Tuesday, March 19, 2013. The Cypriot government sought Tuesday to shield small savers from a plan that is intended to raise euro 5.8 billion ($7.5 billion) toward a financial bailout by seizing money from bank accounts. The plan, which is part of a larger bailout package being negotiated with other European countries, has been met with fury in Cyprus and has sent jitters across financial markets. (AP Photo/Francisco Seco)

  • A Cypriot man wearing a mask of Greek Prime Minister Antonis Samaras smokes a cigarette during a protest against an EU bailout deal outside the parliament in Nicosia on March 18, 2013. Cyprus's parliament has postponed until March 19 a session to vote on the bailout deal that slaps a levy on all Cypriot bank savings, as negotiators scrambled to soften the blow for small deposit holders. AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • Cypriots holding cut-out masks of German Chancellor Angela Merkel (top-R), European Commission head Jose Manuel Barroso (C) and Cypriot President Nicos Anastasiades (top-L) take part in a protest against an EU bailout deal outside the parliament in Nicosia on March 18, 2013. Cyprus's parliament has postponed until March 19 a session to vote on the bailout deal that slaps a levy on all Cypriot bank savings, as negotiators scrambled to soften the blow for small deposit holders. AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • A Cypriot woman wearing a mask of German Chancellor Angela Merkel stands next to a fellow demonstrator wearing a mask of Cypriot President Nicos Anastasiades during a protest against an EU bailout deal outside the parliament in Nicosia on March 18, 2013. Cyprus's parliament has postponed until March 19 a session to vote on the bailout deal that slaps a levy on all Cypriot bank savings, as negotiators scrambled to soften the blow for small deposit holders. AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • Protesters shout slogans during a protest outside of the parliament in Nicosia, Cyprus, Monday, March 18, 2013. A vote on a bailout package for Cyprus that includes an immediate tax on all savings accounts has been postponed until Tuesday evening. Yiannakis Omirou, the speaker of Parliament, said the delay was needed to give the government time to amend the deal reached over the weekend that prompted an outcry from those who thought their money was safe. In order to get euro 10 billion ($13 billion) in bailout loans from international creditors, Cyprus agreed to take a percentage of all deposits — including ordinary citizens' savings — an unprecedented step in Europe's 3 ½-year debt crisis. (AP Photo/Petros Karadjias)

  • A protestor with a mask of German Chancellor Angela Merkel shout slogans during a protest outside of the parliament in capital Nicosia, Cyprus, Monday, March 18, 2013. A vote on a bailout package for Cyprus that includes an immediate tax on all savings accounts has been postponed until Tuesday evening. Yiannakis Omirou, the speaker of Parliament, said the delay was needed to give the government time to amend the deal reached over the weekend that prompted an outcry from those who thought their money was safe. In order to get euro 10 billion ($13 billion) in bailout loans from international creditors, Cyprus agreed to take a percentage of all deposits — including ordinary citizens' savings — an unprecedented step in Europe's over 3 year debt crisis. (AP Photo/Petros Karadjias)

  • A Cypriot couple hang placards from their necks during a protest against an EU bailout deal outside the parliament in the capital, Nicosia, on March 19, 2013. The party of Cyprus' President Nicos Anastasiades will abstain from taking part in a parliamentary vote on an EU bailout, that slaps a levy on all Cypriot bank savings, a party member said. The banner on the right reads in Greek: 'It's capitalism idiots!' AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • Two man pass by the people using the ATM machines outside of a Laiki Bank branch in capital Nicosia, Cyprus, Sunday, March 17, 2013. Cyprus parliament had postponed the debate and vote on the controversial levy on all bank deposits that the cash-strapped countrys creditors demanded in exchange for euro10 billion (US$13 billion) in rescue money, officials said. (AP Photo/Petros Karadjias)

  • A man sits and drink as women use the ATM machine outside of a Bank of Cyprus branch in capital Nicosia, Cyprus, Sunday, March 17, 2013. Cyprus parliament had postponed the debate and vote on the controversial levy on all bank deposits that the cash-strapped countrys creditors demanded in exchange for euro10 billion (US$13 billion) in rescue money, officials said. (AP Photo/Petros Karadjias)

  • A police officer stands by a protest banner outside of parliament before a meeting in capital Nicosia, Cyprus, Monday, March 18, 2013. Cyprus' president is briefing lawmakers ahead of a crucial parliamentary vote on a controversial levy on bank deposits that the cash-strapped country's creditors have demanded in exchange for a euro10 billion (US$13 billion) rescue package.(AP Photo/Petros Karadjias)

  • Children are seen by a protest banner held by protestors outside of the parliament during a crucial meeting in capital Nicosia, Cyprus, Monday, March 18, 2013. Cyprus' president is briefing lawmakers ahead of a crucial parliamentary vote on a controversial levy on bank deposits that the cash-strapped country's creditors have demanded in exchange for a euro10 billion (US$13 billion) rescue package.(AP Photo/Petros Karadjias)

  • A protestor shout slogans outside of parliament during a meeting in capital Nicosia, Cyprus, Monday, March 18, 2013. Cyprus' president is briefing lawmakers ahead of a crucial parliamentary vote on a controversial levy on bank deposits that the cash-strapped country's creditors have demanded in exchange for a euro10 billion (US$13 billion) rescue package.(AP Photo/Petros Karadjias)

  • A protestor with his child hold a banner outside of parliament during a crucial meeting in capital Nicosia, Cyprus, Monday, March 18, 2013. Cyprus' president is briefing lawmakers ahead of a crucial parliamentary vote on a controversial levy on bank deposits that the cash-strapped country's creditors have demanded in exchange for a euro10 billion (US$13 billion) rescue package.(AP Photo/Petros Karadjias)

  • A view of the Bank of Cyprus UK in Charlotte Street, central London, Monday, March 18, 2013. The euro 10 billion (US dlrs13 billion) Cyprus bailout agreed by the EU and IMF demands that all bank customers pay a one-off levy on all bank deposits, to save the country from bankruptcy. Cyprus' president Nicos Anastasiades urged lawmakers to approve the tax when they vote Monday, saying he wants to amend the unpopular eurozone bailout plan to reduce its effect on small savers. (AP Photo / Nick Ansell, PA) UNITED KINGDOM OUT - NO SALES - NO ARCHIVES

  • A man uses an ATM at a bank, right, in Pamplona northern Spain on Monday, March 18, 2013. A plan to tax depositors in Cypriot banks as a way to partly fund a bailout of the Mediterranean island nation impacted on the euro-zone Monday, as officials in Spain and Italy tried over the weekend to reassure their citizens by saying the situation in Cyprus is unique, and that bank deposits in their countries will remain safe. (AP Photo/Alvaro Barrientos)

  • Protesters hold up their hands as they protest outside the parliament in capital Nicosia, Cyprus, Monday, March 18, 2013. A vote on a bailout package for Cyprus that includes an immediate tax on all savings accounts has been postponed until Tuesday evening. Yiannakis Omirou, the speaker of Parliament, said the delay was needed to give the government time to amend the deal reached over the weekend that prompted an outcry from those who thought their money was safe. In order to get euro 10 billion ($13 billion) in bailout loans from international creditors, Cyprus agreed to take a percentage of all deposits — including ordinary citizens' savings — an unprecedented step in Europe's 3 ½-year debt crisis. (AP Photo/Petros Karadjias)

  • Cypriots hold placards during a protest against an EU bailout deal outside the parliament in Nicosia on March 19, 2013. The party of Cyprus' President Nicos Anastasiades will abstain from taking part in a parliamentary vote on an EU bailout, that slaps a levy on all Cypriot bank savings, a party member said. AFP PHOTO/PATRICK BAZ (Photo credit should read PATRICK BAZ/AFP/Getty Images)

  • A man use his mobile phone as he passes outside of the a Russian commercial bank in capital Nicosia, Cyprus, Tuesday, March 19, 2013. A high proportion of deposits in Cypriot banks are believed to be held by Russians and Cypriot Finance Minister Michalis Sarris is flying to Moscow Tuesday to meet with his Russian counterpart. Financial markets are reported to be tense Tuesday as investors await a vote in Cyprus on a contentious plan to help fund the country's bailout by a one off charge on bank deposits although there may be a change to the proposed levy to spare small account holders. (AP Photo/Petros Karadjias)

  • Cypriots use the ATM machines outside of a closed Laiki Bank branch in capital Nicosia, Cyprus, Tuesday, March 19, 2013. Cypriot finance officials are revising a planned financial bailout to relieve small account holders from having to pay a charge on their savings in order to secure an international rescue of the country's troubled banks.(AP Photo/Petros Giannakouris)

  • A Cypriot man asks for help from a member of bank stuff to get money from an ATM machine outside a closed Laiki Bank branch in capital Nicosia, Cyprus, Tuesday, March 19, 2013. Cypriot finance officials are revising a planned financial bailout to relieve small account holders from having to pay a charge on their savings in order to secure an international rescue of the country's troubled banks.(AP Photo/Petros Giannakouris)

  • Pensioner Adreas Tartis 74 years old sits on chair in central Nicosia, Cyprus, Tuesday, March 19, 2013. Tartis said that the situation of Cyprus is difficult. Cypriot finance officials are revising a planned financial bailout to relieve small account holders from having to pay a charge on their savings in order to secure an international rescue of the country's troubled banks.(AP Photo/Petros Giannakouris)

  • An employee of the Stock Exchange walks next to a display showing stock price movements in Athens, Tuesday, March 19, 2013. Banks stocks were sharply lower on the Athens Stock Exchange, as trading resumed for the first time in Greece since the details of a bailout in Cyprus and a shock levy on bank deposits were announced. Trading in the shares of Bank of Cyprus and Laiki was suspended for two days on the Athens Stock Exchange. (AP Photo/Thanassis Stavrakis)

  • A man passes outside of the a Russian commercial bank in capital Nicosia, Cyprus, Tuesday, March 19, 2013. A high proportion of deposits in Cypriot banks are believed to be held by Russians and Cypriot Finance Minister Michalis Sarris is flying to Moscow Tuesday to meet with his Russian counterpart. Financial markets are reported to be tense Tuesday as investors await a vote in Cyprus on a contentious plan to help fund the country's bailout by a one off charge on bank deposits although there may be a change to the proposed levy to spare small account holders. (AP Photo/Petros Karadjias)