Chancellor Werner Faymann’s sudden resignation on Monday could mean the collapse of Austria’s postwar political establishment, while increasing the likelihood of yet another European democracy falling prey to the xenophobic far right.

Mr. Faymann resigned after his own center-left Social Democratic Party abandoned him following a stinging victory by the right-wing Freedom Party candidate, Norbert Hofer, in a first round of presidential elections on April 24. The Social Democratic Party governs in coalition with the conservative Austrian People’s Party. The two parties have dominated Austrian politics for decades.

Mr. Hofer is now poised to win the second and final round of presidential voting on May 22. The office of the president in Austria is largely ceremonial. But Mr. Faymann’s resignation could trigger early parliamentary elections, now scheduled for 2018, that will determine who runs Austria’s next government. That would give the Freedom Party a real chance to come to power, which would be terrible for Austria. The Freedom Party has its roots in Austria’s ugly Nazi past. More recently, it has taken up far-right European nationalist, anti-immigrant and anti-Islam themes.

Last year, Austria was a major pathway for refugees heading from Turkey to Germany. But some 90,000 stayed in Austria. Fearful of a new wave of refugees, Austria is building — over strenuous protest from Italy — a fence on its Italian border.