The parliament of Cyprus approved key legislation bringing its cooperative banks under the direct supervision of the central bank, narrowly avoiding a rejection which would have placed a 10 billion euro bailout programme in jeopardy.
In a marathon voting session which began on Thursday and ended Friday morning, legislators agreed to a clause enabling co-op banks to receive 1.5 bn euros ($1.97 bn) in bailout money.
In exchange for the cash support, the government would take ownership of nearly all of the cooperative banks' shares.
"Despite the problems of the political system and the mistakes and omissions of us all, politicians have demonstrated the responsibility that led to an agreement for the sake of what's best for our country," Averof Neophytou, leader of the ruling, center-right DISY party told parliament.
The money will be ploughed into the lenders to recapitalise them.
In an earlier vote, it had been narrowly rejected by lawmakers from the island's opposition left-wing parties, who oppose any bailout conditions.
In a second vote in the early hours of Friday, parliament approved the restructuring of the co-ops, finance ministry sources said.
Earlier on Thursday, around 500 people protested outside the parliament against austerity measures.
The demonstration was organised by opposition communist party Akel and other left-wing groups who held up placards declaring: "Tax the rich, not the poor" and "We are not beggars".
As part of its rescue, Cyprus in March agreed on a deal that saw deposits over 100,000 euros in its two biggest banks take major losses.
Second largest lender Laiki was shut down and folded into the bigger Bank of Cyprus which is undergoing major restructuring.
Restrictions on withdrawals and transfers from banks were also imposed to prevent a run.
Cyprus and lenders from the International Monetary Fund and the European Commission agreed on a 10 billion euro bailout to the island ($1 = 0.7623 euros).