The Greek government collapsed Monday, setting the stage for elections in four weeks that are shaping up as a contest between the public’s anger over the pain of austerity and its fear that the alternative could be even worse.

If Greece chooses anger and votes for Syriza, the radical leftist party now topping opinion polls, the elections could presage a much broader showdown in 2015. That clash could ripple across Europe as populist politicians challenge the philosophy driving the continent’s agonizingly slow economic recovery.

Far-left parties are gaining ground in several European countries, including Spain and Ireland. But Greece could offer the radical left its first opportunity to govern, and to throw down a gauntlet by demanding an immediate renegotiation of the country’s $284 billion bailout agreement.

Syriza has said that it will stop paying Greece’s debts unless the country’s international paymasters agree to relax the strict economic stewardship required in exchange for the bailout, which saved the country from financial ruin earlier in the decade. The program has helped Greece erase its deficit, but critics say it has contributed to sky-high unemployment and poverty rates that have left the country deeply unsettled.

“The overall framework of the euro zone is in crisis — not from Syriza or the left, but because of the policies of austerity,” said Euclid Tsakalotos, a top Syriza economic adviser. “Unless Europe moves in a more just and socially democratic direction, then it’s in danger.”

Syriza officials insist they will keep Greece in the euro zone, as the vast majority of the public demands. But the party has not said what it will do if the lenders — the European Union and the International Monetary Fund — refuse to negotiate. Experts fear that the party’s hard-line stance, with no discernible backup plan, could lead to an accidental exit from the euro zone.

“Syriza would only put Greece’s position in the euro zone at risk through inexperience and a lack of knowledge of how to negotiate with Europe,” said Nick Malkoutzis, an analyst with MacroPolis, a Web site that tracks developments in Greece.

That prospect spooked investors Monday, with the collapse of the pro-austerity, center-right government sending bond yields sharply higher and Greek stocks to two-year lows.

Although European officials have expressed confidence that fallout from political instability in Greece can be contained, there were indications Monday that it has the potential to spread, with other markets in southern Europe taking hits.

In a commentary issued Monday, Eurasia Group analyst Mujtaba Rahman said the euro zone’s second- and third-largest members — France and Italy — will be particularly susceptible to contagion if Greece descends into political and economic chaos.

“Both countries have done the least in terms of reform since the days of the debt crisis and therefore remain the most vulnerable economically,” Rahman wrote.

Early Greek elections were set in motion when Parliament failed — for a third time this month — to elect a new president.

Usually a formality, the vote instead became a referendum on the government, with the constitution requiring at least 180 members from the 300-strong Parliament to vote for the government’s candidate to stave off collapse.

Prime Minister Antonis Samaras, in office since 2012, had sought for weeks to persuade members of Parliament to stay the course. But he could only watch nervously Monday as a roll-call vote of the fractious body — which spans the ideological spectrum from communist to neo-Nazi — quickly turned against him. In the end, he fell 12 votes short.

Within hours, the campaign had kicked off. Samaras — who set the election for Jan. 25 — urged Greeks not to undo the “sacrifices” that have brought some degree of stability after an economic meltdown that left virtually no one untouched.

“The government did everything possible to get a new president elected, and a minority of MPs now drags the country to early elections,” he said on state-run Nerit TV. “I will do all to guarantee that the country stays on the path of reforms.”

Over the weekend, Samaras had warned that a Syriza government could lead Greece to bankruptcy.

Greece has been at that precipice before. Five years ago, a host of problems, including decades of bloated public-sector spending and mismanagement, pushed the country into a crippling recession and far outside the fiscal rules for nations using the euro.

The bailout kept Greece afloat, but it came with strict demands for fiscal housecleaning. They included sharp cutbacks in government services, punishing public-sector layoffs and other belt-tightening measures.

Syriza leader Alexis Tsipras called the upcoming elections a chance to reverse those austerity programs, which he said had “plundered” the country.

“With the will of our people, in a few days bailouts tied to austerity will be a thing of the past,” Tsipras said. “The future has already begun.”

But on the streets of Athens, there was apprehension that the future could look all too much like the recent past.

“We are very uneasy. We could be going back to 2012,” said Dimitris Stathopoulos, a 57-year-old textile salesman who has had to contemplate shuttering a business that was started by his great-grandfather more than a century ago. “Syriza is promising to do everything for everybody. We know this is impossible.”

Nikolas Zirganos in Athens and Brian Murphy in Washington contributed to this report.