BRUSSELS (AP) -- 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 bailout ($13 billion) to recapitalize its ailing banks 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, the diplomats said. They spoke on condition of anonymity pending the official announcement.

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.

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.