THE writing had been on the wall for many months. Ever since the general election in September and the Social Democrats’ (SPD) worst result in the history of the federal republic, the clock had been ticking on Martin Schulz’s leadership of the party. At first he embraced a return to opposition and the chance to rebuild the party away from the pressures of government. Then in November Angela Merkel’s talks with liberals and greens collapsed and he came close to walking out as colleagues urged him to allow a new “grand coalition” with the chancellor’s Christian Democrats (CDU/CSU). Then came last week’s deal between the parties, which has prompted something close to a nervous breakdown in the SPD.

At a little after half past six today Mr Schulz finally announced his resignation. “I leave this office without resentment or bitterness”, he said before cameras in the Willy Brandt Haus in Berlin, adding that the SPD needed renewal. He also revealed that the party’s ruling committee had unilaterally nominated Andrea Nahles, its leader in the Bundestag, to be his successor ahead of an extraordinary leadership conference in Wiesbaden on April 22nd.

To think that, just a year before, Mr Schulz was being celebrated as a breath of fresh air in German politics. Last January he returned from a 23-year career in Brussels, topped off by the presidency of the European Parliament, to inherit the ailing SPD from Sigmar Gabriel, his old friend, who went on to become Germany’s foreign minister. For a few weeks the party soared past 30% in the polls, pulling almost neck-and-neck with the CDU/CSU. The talk was of the “Schulz hype” and a runaway “Schulz train”. Der Spiegel, a news weekly, simultaneously satirised and fuelled the buzz with a cover hailing him “Saint Martin”. But the hype faded, the poll gains shrivelled and the chancellor candidate failed to find resonant criticisms of a chancellor with whom his party had spent eight years in government. Behind the scenes he dithered and despaired, pulled this way and that by rival advisers. In the end the party took just 20.5% of votes.

What went wrong? Mr Schulz’s last-minute switch into German politics is one explanation. Being away for so long, he was unfamiliar with domestic election campaigns (the peak of his pre-Brussels career had been the mayoralty of Würselen, a small town near Aachen). And it meant he lacked confidence in his own instincts about the German electorate—a flaw painfully obvious in behind-the-scenes accounts of his directionless campaign.

Another factor was his basics diagnosis of his party’s problems. The SPD had been languishing little above 20% in polls for long before he took over the leadership, but the sudden surge in support in the weeks afterwards seems to have persuaded him that he had found the golden formula: he simply needed to tilt a little to the left in rhetoric and focus on his party’s traditional strength of social justice. This was his fundamental mistake, reckons Manfred Güllner, the founder of the Forsa polling agency and a past adviser to successive SPD leaders. Instead, he argues, Mr Schulz should have offered broader national modernisation appealing not just to lower-income voters but to middling ones too, as Brandt and Gerhard Schröder once did.

But this just points to the much bigger problem: like social democratic parties across continental Europe the SPD is in a long-term identity crisis. The party was built for an age of monolithic, class-based political blocs. But today the traditional working class is shrinking as a proportion of the electorate. Voters are more footloose. Left-versus-right political debates increasingly compete with cultural ones on the open-versus-closed axis, where parties like the SPD have no fixed address. Its further slide in recent weeks—one poll today put the party on a modern record low of 16.4%—and the concurrent rise in support for the far-right Alternative for Germany and cosmopolitan Green parties points to the reorientation of German politics (partially, at least) around that new spectrum. The Netherlands, where cultural politics has been prominent for longer and the SPD’s sister party fell to 5.7% at the election last year to the benefit of larger right-populist, green and social liberal rivals, may provide a glimpse of Germany’s political future.

The strain of bringing his fractured, disoriented party back into government with Mrs Merkel ultimately proved too much for the weakened Mr Schulz. Delegates at the SPD’s conference in Bonn on January 21st voted for formal talks with the CDU/CSU by just 56%; Mr Schulz’s lacklustre speech in favour of doing so paling in comparison with a gutsy, tub-thumbing display by Ms Nahles, the SPD’s leader in the Bundestag. The bland coalition agreement that followed has failed to quell the grass roots opposition, led by the Young Socialists. With members due to vote between February 20th and March 2nd on whether to join another grand coalition, Mr Schulz pledged to step down as leader before the formation of any new government; he would in any case become foreign minister. But that prompted further discord last week as Mr Gabriel, who had hoped to keep his job, accused Mr Schulz of deceit and disrespect. On Friday the latter renounced his claim to the post in a bid to stop the personnel debates. But they continued over the weekend. With the SPD sliding ever further in polls and anti-coalition campaigners demanding a vote on the leadership, too, the party’s ruling committee gathered in Berlin this afternoon and agreed that Mr Schulz would go with immediate effect.

The psychodrama is by no means over. Ms Nahles is a pugilistic orator who hails from the SPD’s left but as labour minister from 2013 extended her power base through the party. She would be the first woman leader in the 154-year history of the SPD. And she makes a better advocate of a new grand coalition than Mr Schulz. His departure may help to loosen the perceived link between the party’s election debacle and the case for another deal with the chancellor.

But it is not a game changer. For one thing, Olaf Scholz, the finance minister designate, will serve as interim leader until April 22nd. He has only modest support among SPD members outside his pfeifdom of Hamburg. A “no” vote on March 4th could blow up Ms Nahles’s leadership on the launch pad. And a “yes” vote could channel the rebels’ revolutionary energies into resisting the party bigwigs’ choice of leader; already it seems she will face a challenge for the job from Simone Lange, the mayor of Flensburg, at the conference in April. The switch of chief may give the SPD a short poll boost—but most of the underlying tensions that brought down Mr Schulz’s leadership remain.