Angela Merkel has won a fourth term in Germany but suffered her worst result ever, losing huge numbers of votes to the right-wing AfD party.

Despite having created great anger in some parts of German society by allowing up to one million refugees into the country, Angela Merkel has survived this election, but with a warning shot across the bows. Her CDU party and its alliance with the Bavarian CSU suffered its worst result since 1949, with an 8.5% drop in support since the 2013 general election. And although a backlash had been predicted, its scale was worse than expected by most political commentators.

The bigger surprise was the size of the rise of the new right, represented by the AfD (Alternative for Germany) party, which has not only achieved enough votes to enter parliament but has become the third largest party. New right in this context meaning a party which has created an acceptable face for almost 13% of the electorate but which still arouses anger and revulsion among many sections of Germany society.

Having been created in 2013 as an anti-Euro party, the AfD has been through a number of changes, shedding skins to eventually settle on its current anti-immigration and anti-Islam stance. Unlike previous right-wing parties it has enjoyed wide electoral success on a state parliament level, maintaining  a veneer of democratic respectability, frequently undermined by extreme statements from some its members and elected representatives.

In a taste of things to come co-leader Alexander Gauland stated at a press conference today:

“One million people, foreigners, being brought into this country are taking away a piece of this country and we as AfD don’t want that. We say I don’t want to lose Germany to an invasion of foreigners from a different culture. Very simple.”

This election has announced an important change, bringing right-wing nationalist politics back into the political mainstream in Germany, and thereby bringing the country in line with the political mood across Europe. The differences here being the weight of history and breaking the taboo of open racism, which sets alarm bells ringing world-wide and damages the country’s image.

But a strong reaction against this result has already been seen on the streets.

By and large the absorption of such a huge number of refugees has been a success so far, and one probably no other country in Europe could have managed, but absorption and settlement is not integration. Time will tell whether this challenge can be met in an atmosphere which has moved from cheering crowds at the rail stations to simmering discontent expressed at the ballot box. Where so-called nationalism ends and something much nastier begins, on the new right-wing spectrum in Germany, remains to be seen.

As the leadership of many political parties strongly expressed on the national post-election TV debate, it probably was and probably still is wrong and disproportionate to allow one party to dominate the electoral aftermath. However, in an election that was dominated by issues of extraordinary banality – such as diesel car engines, the car industry, and a strange obsession with “digitalisation” – controversial views and echoes of history repeating were bound to arouse interest.

This election was not just the story of the AfD and Mrs Merkel’s payback time though. As the right rose the social democratic SPD had their worst ever post-war electoral result, sinking to 20.5%, a fall of 5.2% compared to their 2013 result.

Having started with a new face in Martin Schulz, fresh from his role as President of the European Parliament, and in theory carrying new energy and no negative domestic political baggage, they have had a dismal campaign with initial polls ratings of around 30% sinking rapidly during the campaign. Last night during the post-election post-mortem on national TV he actually showed some passion and bite for the first time, as he firmly rejected Angela Merkel’s tentative political flirting and said his party would remain in opposition. While his analysis that the electorate had rejected the previous grand coalition of the SPD with the CDU/CSU was probably correct, the vehemence and finality with which he rebuffed her advances was surprising in a political system based on coalition and co-operation.

Many viewers no doubt wondered where this too little too late passion had been during the campaign, where he had unfortunately come across as something of a hollow man, lacking emotion or any meaningful arguments with which to distinguish his party from the CDU. Even in a country enjoying unprecedented economic success in comparison to its EU neighbours there are issues around the working poor, resources for schools and basic infrastructure and affordable housing in cities, which should have been natural material for his campaign.

During his one live TV debate with Angela Merkel he seemed devoid of ideas and lacked fighting spirit, almost as if preparing for a continuation of the coalition and therefore going through the motions in school debating club style.

Quite what went wrong, with the manifesto choices, the media debate focus and the toothless tiger performance of the man himself is a mystery, but given the choice between more of the same or no perceptible change many voters opted for the careful and small c conservatism of the devil they know. More middle instead of another middle was the inevitable choice, and for those really unhappy with Frau Merkel there was plenty of choice across the political spectrum.

In that spectrum both the socialist Die Linke party and the Grünen (Green party) made slight gains, while the conservative FDP returned to parliament with an increase of 5.9% and an overall share of 10.7%. This has been a huge success, as it takes them over the 5% threshold needed to secure parliamentary seats and makes them potential coalition partners in the new government.

Although Angela Merkel will lead the largest group in parliament she has reasons to be concerned, though, because there will be some long days and nights ahead as she seeks to put together a coalition to govern the country. With Martin Shultz having metaphorically stamped off home, she has to try and build a so-called Jamaica coalition (as in colours of the flag, colours of the parties) with the FDP and Greens. Given their very different agendas, this will be a bit like trying to herd cats and keep calm while doing so. But given the tradition of political coalitions in Germany it is certainly not a foregone conclusion that this will not work.

As the results sink in to the national consciousness the big questions are, firstly, what this means for Germany, both in terms of domestic mood and international reputation. A worrying threshold has been crossed, which you can either argue returns Germany to the new political normality of “me firstism” expressed in the US and UK recently, or you can see it as a step into dangerous waters muddied by the lessons of past misdemeanours. Secondly, what will be the damage done to Angela Merkel and her somewhat overstated position in recent times as leader of the free world, linchpin of European stability and counter-weight to the tawdry triumphalism of Mr Trump.

The first question will be answered by the social and political climate during the next four years, and how wider society and politicians shape the national debate on integration, immigration, values and common decency. As for Angela Merkel, although this fourth term sees her theoretically weakened it would be premature to rule out the chances of her cautious pragmatism slowly but surely getting to grips with the challenges ahead. For Germany this is a crucial moment in its post-war history, a time for a collective display of knowing, and showing the world, what is right and wrong.