Until a couple of weeks ago, it seemed that one of the few things you could be certain about in a time of huge uncertainty elsewhere in the west was that Angela Merkel would become German chancellor for a fourth term following this September’s election. The February issue of the magazine Cicero showed Merkel emerging from a ballot box with the headline: “What’s the point of voting anymore?” The only real question was what kind of coalition she would lead: yet another grand coalition of Christian Democrats and Social Democrats (the third in four electoral periods), or possibly the first ever “black-green” coalition?

It was not as if Germany was immune from the rise of populism that is creating such extraordinary upheaval elsewhere in Europe and the United States – though some in German initially believed it was. The Eurosceptic and anti-immigration party, Alternative für Deutschland (Alternative for Germany, AfD), scored a series of stunning successes in regional elections in 2016 and polls suggested it would win somewhere between 10% and 15% of the vote in the election in September. But the German electoral system and the dynamics between the six parties expected to win seats in the Bundestag actually meant that the better the AfD did, the more likely it was that there would be another grand coalition – led by Merkel.

Then Sigmar Gabriel, the Social Democratic Party (SPD) leader who had been expected to be its candidate, dropped out and European Parliament president Martin Schulz took his place – and suddenly everything looked different. The SPD had been polling in the mid-twenties for years and was so resigned to its fate that in 2015 a senior Social Democrat even wondered publicly whether they needed a candidate at all for chancellor, since Merkel was doing such an “excellent” job. But immediately after Schulz announced his candidacy in late January, the SPD shot up to around 30% in the polls – neck-and-neck with the Christian Democrats. Suddenly, there seemed to be a realistic chance of a Social Democrat winning a general election in Germany for the first time since 2002.

The excitement around the candidacy of Schulz is something of a puzzle – he is hardly a charismatic or visionary figure. Some think of him, though, as “populist of the centre” because of the way he presents himself as a man of the people. He does have a compelling biography: he dropped out of high school, hoped to become a professional football player and struggled with alcoholism. But the most plausible explanation for his sudden popularity is that it reflects pent-up demand for a real alternative to Merkel, who many Germans are fed up with after more than a decade in power. Since the refugee crisis began in the summer of 2015, many voters angry with her approach to it turned to the AfD. But the polls suggest some of those voters might now vote for Schulz, with the AfD slumping below 10%.

Schulz’s big advantage is that, unlike Gabriel, who had been economics minister since 2013 and took over as foreign minister a month ago, he is not implicated in the right-wing economic policies of the two grand coalitions under Merkel, in which the SPD has been the junior partner. Since the financial crisis of 2008, the Social Democrats have aligned themselves with Merkel and in particular backed her hawkishness on deficits. Most of Schulz’s career, meanwhile, has been spent in Brussels rather than Berlin. He can therefore credibly attack Merkel and offer an alternative – especially on economic and social policy.

The SPD’s problems go all the way back to the “red-green” government of Gerhard Schröder between 1998 and 2005. In particular, the Agenda 2010 reforms that he introduced in 2003 – which cut social security and health care benefits, reduced state pensions and made it easier to fire employees – alienated many working-class voters, especially in the east of Germany. In 2005, Oskar Lafontaine, who had been Schröder’s finance minister for a few months before resigning, formed a new left-wing party, Die Linke, which won 9% of the vote at that year’s election. Nevertheless, the SPD stood by Agenda 2010, which they claimed was decisive in the turnaround in the German economy in the mid-2000s. (In reality, the outsourcing of production to central and eastern Europe, and wage restraint, were more important in making German manufacturing competitive again.)

Since then, it has become almost structurally impossible for the Social Democrats to lead a government unless it can overcome its differences with Die Linke – which includes former East German Communists – and form an “R2G”, or “red-red-green”, coalition of Social Democrats, Die Linke and the Greens. After another ignominious defeat in the election of 2013, Gabriel took over as party leader and sought a rapprochement with Die Linke. But then came the Ukraine crisis, and the gap between Die Linke and the SPD on foreign policy – especially in relation to Russia – widened rather than narrowed. The SPD was back to square one.

But in his first big campaign speech in Bielefeld last week, Schulz attacked Agenda 2010, saying that the SPD had made mistakes that it was now necessary to correct. He criticised the increase in income inequality and the growth of insecure and badly paid jobs in Germany in the past decade, which he blamed on a “neoliberal mainstream” that had declared workers’ rights and social welfare to be “obstacles to growth”. This left-wing rhetoric came as a surprise. “Schulz was not generally seen as one of the more left-wing figures in the party,” says Sebastian Dullien, a Berlin-based economist.

Some hope that, were Schulz to be elected, a shift to the left on economic policy might also offer a way to bridge differences with France on eurozone policy – especially if independent candidate Emmanuel Macron is also elected as French president in May.

Since the euro crisis began in 2010 the Social Democrats have increasingly supported Merkel’s unyielding approach and sometimes – for example, in the summer of 2015 when her finance minister, Wolfgang Schäuble, threatened to kick Greece out of the euro – seemed to want to be even tougher on the left-wing Syriza government. Now they are suddenly talking about the suffering of the Greek people.

In Bielefeld, Schulz called for more investment in education, infrastructure and digital technology. But there are limits to how far even Schulz will go. He is not considering a rethink of the Schuldenbremse, or “debt break”, that the Social Democrat finance minister Peer Steinbrück introduced in Germany in 2009 and has since been imposed on the entire eurozone to limit deficit spending. “That is not up for debate,” Schulz ally Ralf Stegner told Reuters. Nevertheless, the Christian Democrats are likely to tell voters that he wants to mutualise eurozone debt and create the “transfer union” that they fear – in other words, an EU in which the fiscally irresponsible endlessly subsidise the fiscally responsible.

However, while an “R2G” government led by Schulz could be good for the European Union, it could be disastrous for Nato, whose future now hangs in the balance since the election of Donald Trump as president of the United States. The Trump administration has made it clear that it wants European allies to rapidly increase defence spending to reach the target of 2% of GDP to which they are committed. If they don’t, the US may “moderate its commitment” to Nato, as Defence Secretary James Mattis ominously put it earlier this month.

Merkel has agreed to increase Nato spending – albeit slowly and with caveats. But Social Democrats do not see the need to increase spending at all and prefer the idea of deepening defence co-operation with France.

It is not yet clear whether Schulz’s current popularity is sustainable or merely a bubble that will burst over the next few months – especially as the Christian Democrats step up their attacks on him (Schäuble has already compared him to Trump). There also remain difficult questions about whether, even if they secure a majority in the Bundestag after the election, the Social Democrats, the Linke and the Greens can reach agreement on policy – especially on Russia. In some ways, says Jörg Lau, foreign editor of the Hamburg-based weekly newspaper Die Zeit, it will be harder than ever to do so now that Trump is in the White House: “If the SPD softens the tough line towards Moscow, it will be suspected of strengthening an authoritarian coalition that is plotting against Europe and western values.”

Hans Kundnani is a senior transatlantic fellow at the German Marshall Fund and the author of The Paradox of German Power