Updated

Imagine waking up to find out that as much as 40 percent of the money you thought was safely deposited in the bank was seized, without your permission, to bail out a near-bankrupt government.

That's just what thousands of large depositors in Cyprus woke up to Monday morning after European Union officials accepted a last-minute deal offered by the island's lawmakers to secure a $13 billion bailout to avert imminent financial meltdown.

The deal, which also slashed the island's oversized banking sector, came as euro ministers in Brussels threatened to cut off crucial emergency assistance to Cyprus' embattled banks after business on Monday if no agreement was reached.

Without that EU funding, Cyprus' banks would have collapsed, dragging the country's economy down with them and threatening the small Mediterranean island's membership of the 17-strong group of European Union countries that use the euro -- all of which would have sent the EU's markets spinning.

"It's not that we won a battle, but we really have avoided a disastrous exit from the eurozone," Finance Minister Michalis Sarris said in Brussels.

More On This...

"This decision is painful for the Cypriot people. This decision was a defeat of solidarity, of social cohesion, which are fundamental freedoms, fundamental principles of the European Union," Parliament President Yiannakis Omirou told AP.

The deal also angered Russia's leaders. It is believed that many of the affected large accounts belong to Russian depositers, and Moscow has been a major lender to prop up the Cypriot banking system. It's been estimated that Russians have more than $31 billion deposited in Cyprus banks.

Dmitry Medvedev reportedly likened the deal to "the stealing of what has already been stolen continues," the Telegraph reported, a reference to Vladimir Lenin's explanation of the Bolshevik seizure of capitalists' assets and property.

Last week Medvedev likened the bank seizure to "a certain period of time by Soviet authorities, who did not stand on ceremony when it came to people's savings."

Russian President Vladimir Putin, meanwhile, ordered the government to look into restructuring the terms of a more than $3 billion loan, a move that appeared to please EU ministers.

Cyprus banks, meanwhile, were rationing the amount of money they were dispensing to 100 euros, trying to avert a run on cash from nervous depositers.

Under the deal, Laiki, the country's second-largest bank, will be restructured, with all bond holders and people with more than 100,000 euros in their accounts facing significant losses. The bank will be dissolved immediately into a bad bank containing its uninsured deposits and toxic assets, with the guaranteed deposits being transferred to the nation's biggest lender, Bank of Cyprus.

Jeroen Dijsselbloem, who chairs the meetings of the eurozone's finance ministers, said it was not yet clear how severe the losses would be to Laiki's large bank deposit holders, but he noted that it is expected to yield 4.2 billion euros overall -- or much of the money that Cyprus needed to raise to secure the bailout. Analysts have estimated investors might lose up to 40 percent of their money.

Large deposits with Bank of Cyprus above the insured level will be frozen until it becomes clear whether or to what extent they will also be forced to take losses, the Eurogroup of finance ministers said in a statement.

Without a bailout deal by Monday night, the tiny Mediterranean nation would have faced the prospect of bankruptcy, which could have forced it to become the first country to abandon the euro currency. That would have sent the region's markets spinning.

The eurozone finance ministers accepted the plan after hours of negotiations in Brussels between Cypriot officials and the so-called troika of creditors.

Markets in Europe reacted positively, opening sharply higher, and the euro was back near $1.30, though the measures are likely to deepen the recession in Cyprus.

"We believe that this will form a lasting, durable and fully financed solution," said IMF chief Christine Lagarde.

To secure the rescue loan package, the Cypriot government had to find ways to raise 5.8 billion euros ($7.5 billion) on its own. The bulk of that money is now being raised by seizing bank assets from large deposit holders, with the remainder coming from tax increases and privatizations.

The cash-strapped island nation has been shut out of international markets for almost two years. It first applied for a bailout to recapitalize its ailing lenders and keep the government afloat last June, but the political negotiations stalled. After a botched agreement last week, the ECB threatened to cut off emergency assistance to the country's banks.

"We've put an end to the uncertainty that has affected Cyprus and the euro area over the past week," Dijsselbloem said.

That uncertainty around the nation of about 800,000 had shaken the entire eurozone of 300 million people, even though Cyprus only makes up less than
0.2 percent of the eurozone's economy.

Several national parliaments in eurozone countries such as Germany must also approve the bailout deal, which might take another few weeks. EU officials said they expect the whole program to be approved by mid-April.

Dijsselbloem defended the creditors' approach of making deposit holders take heavy losses, saying the measures "will be concentrated where the problems are, in the large banks."

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

The drastic shrinking of the financial sector, the wiping out of wealth through the losses on deposits, the loss of confidence with the recent turmoil and the upcoming austerity measures all mean that Cyprus is facing tough times.

The Associated Press contributed to this report.