VIENNA — Austria’s chancellor resigned abruptly Monday after nearly eight years in office, throwing his country into deeper political uncertainty after a first round of presidential elections last month in which the two governing establishment parties failed to muster even a quarter of the popular vote.

The resignation occurred amid a rightward shift in Austrian politics, fueled by anxiety over the migration crisis.

“I am grateful that I was allowed to serve the country,” Werner Faymann, the chancellor since 2008, said at a news conference in Vienna, announcing that he was stepping down as both chancellor and as the leader of his party, the center-left Social Democrats.


Vice Chancellor Reinhold Mitterlehner, who is from the other establishment party, the conservative Austrian People’s Party, will serve as interim chancellor, said Astrid Salmhofer, a spokeswoman for President Heinz Fischer.

Fischer was expected to formally invest Mitterlehner with those duties, she said.

Under Austria’s constitution, Mitterlehner could remain in office days, weeks or even months, she said. Parliamentary elections are not expected until 2018, though an early election could be called.

Michael Haupl, the veteran mayor of Vienna, who won a tight race last year with a pro-immigrant stance, will take over as the temporary leader of the Social Democrats.

Two weeks ago, a far-right candidate, Norbert Hofer of the Freedom Party, decisively won the first round of the country’s presidential elections.

While the presidency is largely ceremonial, the vote was a heavy blow to Faymann. He quickly lost support within his party, which has governed for the past decade in a grand coalition with the People’s Party, a political constellation that has dominated post-World War II Austria.

Although Faymann was in trouble, the timing of his announcement came as a surprise to many Austrians.

“We need to fight unemployment, guarantee social cohesion and, in the refugee crisis, ensure order and humanity,” Faymann said. “The question was thus: Did I have the full support of a strong backing from the party? I have to answer in the negative.’’


Hofer received more than a third of the vote in the first round of the election, on April 24, and independent candidates came in second and third. He faces a former Greens leader, Alexander Van der Bellen, in a tight runoff scheduled for May 22.

The two establishment parties together received just 22 percent of the vote last month.