Hours after police and demonstrators clashed in central Athens, Greek lawmakers on Thursday approved austerity measures that were overwhelmingly rejected by their citizens just days ago.

The vote represented a stark turnabout for the government, and it was the price Greece’s lenders demanded for saving the country from a whirlwind of economic turmoil. It was a stunning defeat for populist forces that have pushed for a break from years of grinding cuts that powerhouse economies led by Germany have enforced as the key to growth.

In the new topsy-turvy reality, leftist Prime Minister Alexis Tsipras was tasked with advocating a stricter version of the austerity he has long opposed. In a sign of his new weakness, 40 of the 149 lawmakers from his Syriza party abandoned him, saying their nation was taking more of the same toxic medicine that had forced it into five years of penury. The defections threatened the stability of his rule, raising the specter of fresh elections and even more economic turmoil.

In the short term, the adoption of the new measures was a milestone on the road toward European approval of an up to $96 billion bailout, sparing Greece from surefire bankruptcy and its ouster from the shared euro currency. Already, banks have been closed for more than two weeks. With a dearth of cash to fuel basic transactions, Greece’s economy is slowly suffocating under the pressure.

Greek leaders were stuck Wednesday urging the approval of measures to which they could offer only tepid support, acknowledging that they may send their country into deeper recession.

Greeks “can understand the difference between those who fight with their soul in battle and resist, and those who hand in their weapons and give up with no resistance,” Tsipras told lawmakers in a speech capping the contentious late-night debate. “The outcome of these negotiations is of course not what we wanted.”

The defectors included several members of Tsipras’s cabinet. Among the outcomes from the split could be the fall of Tsipras’s government and possible new elections — with all the fresh complications they could bring if anti-bailout forces gain ground. At a minimum, Tsipras will be tasked with implementing unpopular measures with a greatly weakened base of support. In the end, 229 of the 300 members of the Parliament supported the bailout laws, but much of the support came from opposition parties.

As lawmakers hurled insults at one another ahead of the vote, anti-austerity protesters and riot police traded molotov cocktails and tear gas outside Greece’s neoclassical Parliament building, the worst such confrontation in years.

Such clashes were a regular feature of anti-austerity demonstrations during the early years of Greece’s debt crisis. But recently they have been rare, and this was the first of any significance since Syriza came to power in January.

There was powerful symbolism in the half-hour burst of violence, with Tsipras and his partners — who not long ago were manning the barricades against the authorities — now overseeing the crackdown on their anti-austerity base.

Thursday’s vote capped weeks of turmoil that started when Tsipras walked away from bailout negotiations late last month and called a snap referendum that handed the choice of austerity to the Greek people.

The decision sparked a bank run, shuttered banks and ushered in a new cash-poor reality after limits of 60 euros, about $67, were imposed on daily ATM withdrawals. Greeks rejected the austerity demands by a landslide, but Europe refused to budge. Tsipras had to capitulate or be kicked off the euro. His surrender was the culmination of a 17-hour slugfest that ended early Monday morning.

Yanis Varoufakis, who stepped down as finance minister last week, threw his lot with the dissenters.

“How can I possibly vote ‘yes’ to monsters and the new Versailles Treaty?” he said in reference to the peace accord that ended World War I and imposed harsh terms on the losers.

Even Greece’s creditors have split over the best path for the struggling Mediterranean nation. A scathing International Monetary Fund report released Tuesday concluded that Greece’s debts are unsustainable even with its third rescue package in five years — which will require further spending cuts for the country’s battered economy. The report suggests a 30-year grace period for repayment.

“No matter what form it takes . . . one way has to be found in order to release the burden and allow the country to demonstrate that it can be back on a sustainable path,” IMF Managing Director Christine Lagarde told CNN on Wednesday.

Greece’s European lenders have opposed significant debt relief. Germany has held the hardest line of all, although a Finance Ministry spokesman on Wednesday cracked the door to a limited delay to when Greece must repay what it owes to its lenders.

The bailout package approved by parliamentarians early Thursday includes many of the measures repudiated by voters less than two weeks ago in the referendum. They include tax hikes on businesses and individuals, pension cuts and aggressive budget surplus targets that will keep government spending lean for years to come.

Even with the approval, however, Greece’s economic future remains in limbo. Germany’s Parliament must give its own endorsement of the agreement in a Friday vote, even as opposition to another Greek bailout rises in Berlin. Several other euro-zone countries will hold parliamentary votes.

European finance ministers, meanwhile, need to figure out a mechanism to provide Greece with enough emergency funding to cover its debts for the next several weeks while details of the bailout agreement are being negotiated. Most pressing is a Monday deadline for a 3.5 billion euro payment due to the European Central Bank.

Demonstrators in Athens on Wednesday expressed disappointment that the government had not used the leverage gained from the referendum on Europe’s bailout proposals to win more favorable terms.

“We voted ‘no’ in the referendum. But now it’s like we said ‘yes,’ ” said Vassilis, a 33-year-old engineer and anarchist who declined to give his last name for fear of attracting attention from the authorities.

Read more:

Germany doesn’t want to save Greece. It seems to want to humiliate Greece.

In Greece, Chanel becomes more valuable than cash

With Greek banks still shuttered, unsold eggs point to deeper woes

Ylan Q. Mui in Washington contributed to this report.