Cyprus' President Nicos Anastasiades
Cyprus' President Nicos Anastasiades leaves the European Council building in Brussels

Cyprus has clinched a last-minute bailout deal with its international lenders to avert a potential exit from the eurozone and the collapse of its banking system.

Under the terms of the deal, agreed by eurozone finance ministers, Cyprus will get €10bn ($13bn/£8.5bn) in early May from fellow eurozone countries and the International Monetary Fund (IMF).

The country's second-biggest bank, The Popular Bank of Cyprus - known as Laiki - will be closed down and holders of more than €100,000 in bank deposits will face big losses. However deposits under €100,000 will not suffer any losses as they will be "fully guaranteed" by the state.

The deal will reduce the size of Cyprus's banking sector as the Laiki will be split into two and its healthy assets will be added to the Bank of Cyprus to create a "good bank". The levy on uninsured Laiki depositors will raise about €4.2bn for the country.

A one-time levy of 20 percent would be placed on uninsured deposits at the Bank of Cyprus, to help raise €5.8bn demanded by the lenders for the larger bailout fund. A separate tax of 4 percent would be levied on uninsured deposits at all other banks, including the 26 foreign banks operating in the country.

The deposit tax will not require approval by the Cypriot Parliament as demanded by the IMF.

The deal came after some 10 hours of talks between Cypriot President Nicos Anastasiades and the eurozone finance ministers, European Central Bank (ECB) and IMF leaders. Anastasiades had also threatened that he would resign if a deal was not reached, according to media reports.

The ECB had set a deadline of 25 March for a deal after the Cyprus Parliament approved the alternative proposal that avoided a one-time levy on small depositors.

Parliament rejected an initial plan last week, amid widespread protests. The deadlock forced the closure of Cyprus's banks, and widespread public panic; on Sunday the island's biggest lender, Bank of Cyprus, limited ATM cash withdrawals to €120 a day, fearing the removal of huge amounts of money.

Failure to reach an alternative agreement would have forced the ECB to cut off funds to the banks, resulting in their collapse. However they are now set to reopen in the coming days.

The discussions over the re-opening of Cyprus' banks will be held today by the Cypriot government and the eurozone finance ministers, according to Eurogroup president Jeroen Dijsselbloem, who added that the agreement has "put an end to the uncertainty" around the Cypriot economy.