Greece's government emerged bloodied but alive following a key vote in parliament, which saw lawmakers overwhelmingly approve new creditor-demanded reforms, despite a clear rift among the governing left-wing Syriza party and thousands of people protesting outside.
The reforms to the judiciary and banking systems were the final hurdle the financially-battered country was obliged to clear before it can start talks with its international creditors on a third bailout worth around 85 billion euros ($93 billion).
Without the money Greece would face further financial chaos and a forced exit — or "Grexit" — from the Eurozone.
Before the debate got underway, about 10,000 people demonstrated outside the parliament in Athens, protesting the latest measures to overhaul Greece's judicial and banking sectors. Minor violence marred the end of the protest when a few teenagers threw petrol bombs at riot police, but no injuries or arrests were reported.
Lawmakers eventually voted 230-63 in favor of the measures, following a whirlwind debate that ended at 4am local time.
Prime Minister Alexis Tsipras was unable to forestall a second revolt in a week among his own Syriza party lawmakers, but had no trouble passing the draft legislation with the backing of pro-European opposition parties.
Related: Banks Have Reopened in Greece, but Almost Everything Has Become More Expensive
Government spokeswoman Olga Gerovasili conceded that there is a clear rift within Syriza, but would not say whether rebels would be expelled.
"From this point on, party procedures will be followed in order to deal with the problem," she said after the vote.
The number of disaffected Syriza lawmakers, who see the reforms as a betrayal of the anti-austerity platform that brought their party to power in January, shrunk slightly compared to last week's similar vote — from 38 to 36. But that is still roughly a quarter of all the party's representatives.
Addressing parliament before the vote, Tsipras said the reforms were a necessary price to pay to keep Greece alive after stormy talks with its creditors nearly collapsed earlier this month.
"We have chosen a compromise that forces us to implement a program in which we do not believe, and we will implement it because the alternatives are tough," he told lawmakers. "We are summoned today to legislate under a state of emergency."
The prime minister also ruled out resigning.
"The presence of the left in this government isn't about the pursuit of office, it's a bastion from which to fight for our people's interests," he said. "And as far as I'm concerned, I won't abandon this bastion, at least of my own free will."
Related: The European Union Still Can't Agree on How to Relocate Migrants Stuck in Greece and Italy
Negotiations with creditors are now expected to start soon.
Thursday's vote was Tsipras' second crunch test in parliament in a week.
Many in Syriza, including former finance minister Yanis Varoufakis, voted against last week's austerity measures, which included a big hike to sales taxes that took effect on Monday. Yet Varoufakis voted in favor of the reforms on Thursday.
In Brussels, Pierre Moscovici, the European Union's top economy official, said he hopes the bailout deal can be signed by mid-August, although he acknowledged that means Greece has to meet a "punishing" schedule.
In return for Greece's bailouts, successive governments have had to enact harsh austerity measures to try to get public finances into shape. Though the annual deficit has been reduced dramatically, the country's debt burden has risen as the Greek economy has shrunk by around a quarter.
The European Union's statistics agency announced on Wednesday that Greece was making some progress on the debt front at the start of 2015, though that improvement was largely erased by the bank closures and other recent events.
Following repayments to European creditors and the International Monetary Fund, Eurostat said Greece's debt fell to 301 billion euros at the end of the first quarter from 317 billion at the end of 2014. That took the country's debt burden down to 168.8 percent from 177.1 percent.
Greece's debt still remains the highest in the 19-country Eurozone by a wide margin.
The Associated Press contributed to this report.