BRUSSELS — Struggling into the early-morning hours to avoid a collapse of Cyprus’s banking system, European Union leaders on Monday agreed on a bailout package intended to keep Cyprus in the eurozone and rebuild its devastated economy.
The deal, struck after hours of meetings here, was approved by the finance ministers from the eurozone, the 17 countries that use the common currency. It would drastically prune the size of Cyprus’s oversize banking sector, bloated by billions of dollars from Russia and elsewhere in the former Soviet Union.
The deal would scrap the highly controversial idea of a tax on bank deposits, although it would still require forced losses for depositors and bondholders.
“We have a deal,’’ President Nicos Anastasiades of Cyprus was quoted as saying by Greek media. ‘‘It is in the interests of the Cypriot people and the European Union.’’
The head of the finance ministers, Jeroen Dijsselbloem of the Netherlands, said the agreement could ‘‘be implemented without delay’’ without a new vote by the Cypriot Parliament, which had rejected a deal last week, because lawmakers had already passed legislation Friday that set the framework for the new action. Cyprus would get the first payment of the package worth $13 billion in early May.
‘‘This has indeed been an arduous week for Cyprus,’’ he said.
Under the agreement, Laiki Bank, one of Cyprus’s largest, would be wound down and senior bondholders would take losses.
Depositors in the bank with accounts holding more than $130,000 would also be heavily penalized but the exact amount of those losses would need to be determined.
The plan to resolve Laiki Bank should allow the Bank of Cyprus, the country’s largest lender, to survive. But the Bank of Cyprus will take on some of Laiki’s liabilities in the form of emergency liquidity, which has been drip-fed to Laiki by the European Central Bank.
Depositors in the Bank of Cyprus are likely to face forced losses rather than any form of tax.
That plan, which set off outrage last week in Cyprus and as far away as Moscow, has been dropped entirely, according to European Union officials who briefed reporters on the deal.
These provisions, if put into effect, should help reverse what, in recent days, has been Cyprus’s steady retreat into a surreal premodern economy dominated by cash.
Retailers, gas stations, and supermarkets, gripped by uncertainty over whether Cyprus would really secure a $13 billion financial lifeline, have increasingly refused to take credit cards and checks.
“It’s been cash-only here for three days,’’ said Ali Wissom, the manager at Il Forno di Jenny’s restaurant off Cyprus’s main square in Nicosia. ‘‘The banks have closed, we don’t really know if they will reopen, and all of our suppliers are demanding cash — even the beer company.’’
With major banks in Cyprus shut for more than week, a trip to the cash machine has become a daily ritual for anyone in Cyprus in need of money. The initial limit on withdrawals was 400 euros. It then fell to 260. As of Sunday night, it slipped to a meager 100 euros.
At the Centrum Hotel, Georgia Xenophontes, 23, an employee in the front office, said she drained her bank account at a cash machine last week — just in time to avoid being hit with the latest withdrawal limit.
“This is affecting everything in our lives,’’ she said. ‘‘Even though you don’t want to count on money, you need it. But we don’t have stability.’’
Without a deal, Cyprus had faced a deadline of Monday night to avoid a banking collapse, as the European Central Bank threatened to shut off financing for banks without a rapid accord on the bailout.
In Brussels, the day was filled with confusion and rancor. Reports filtered out of heated confrontations between Anastasiades and European Union negotiators, and especially with the International Monetary Fund, which Anastasiades has accused of trying to push Cyprus up against a wall.