For a leader that has been in power for almost a dozen years, Angela Merkel can take most of the credit for ensuring that her conservative bloc of the Christian Democratic Union (CDU) and the Christian Social Union (CSU) remain the largest grouping in the Bundestag, or German parliament.

But it comes at a very high cost.

Germany’s third biggest political party is now the Alternative for Germany (AfD). It won 13.1 percent of the vote, according to the preliminary results.

This is a party that is anti-Islam and that wants strict curbs on immigrants and refugees. It is a party in which some of its leaders have questioned the need for memorials to the Holocaust; a party in which some of its leaders have asked for how much longer Germany has to carry the burden of the past. The AfD’s victory has dented the postwar consensus, whereby the far right would remain outside the political consensus and thus outside the political establishment.

The Alternative for Germany, however, is far from monolithic. There are genuine Euroskeptic members that dislike the party’s far-right stance. But what united them was Merkel’s 2015 decision to open Germany to over one million refugees. As a result, the chancellor’s conservative bloc scored an historic low. It won 33 percent of the vote, a fall of over 8.5 percent compared to 2013.

No wonder Merkel said she had hoped for a better result. It would have given her a much stronger hand in forming Germany’s next coalition, which is expected to be made up of the conservatives, the pro-business Free Democrats, and the Greens.

In her brief victory speech at the packed CDU headquarters in Berlin, Merkel was forced to acknowledge how the far-right Alternative for Germany had sapped into the conservative vote, and how over 980,000 supporters defected to the AfD, while 1.3 million voters also went over to Free Democrats. The former voted against Merkel’s refugee policy. The latter voted for a government that would focus on domestic reforms, including the challenges of digitization and climate change, both of which are concerns that the incoming government will have to deal with. Expect big arguments between all four coalition parties over energy policy and on EU issues, particularly on the integration of the eurozone.

But it is on the domestic front that Merkel will have to deal with two competing pressures: an AfD that is anti-immigration, anti-Islam, and anti-Europe, while the Free Democrats want Germany to be much more prepared to embrace globalization, the country’s serious demographic problems, and a more competitive energy policy that would entail reducing subsidies for renewable energy. That is something that the Greens are sure to oppose during coalition talks.

So Merkel’s victory is a bittersweet one. AfD leaders have already said they would try to establish a parliamentary committee of inquiry into how the chancellor unilaterally adopted her refugee policy. The party wants to hold Merkel accountable for that decision, with leaders even using the word “hunt” as they celebrated their electoral victory.

But their victory will be curtailed in the Bundestag. This is because Martin Schulz, the leader of the Social Democrats—which also had an historic low, polling only 20.5 percent compared to 25 percent in 2013—said his party will not remain in the grand coalition. Instead, it will return to the opposition benches, which will include Die Linke, whose main constituency is in Eastern Germany.

Schulz’s decision is important; it robs the AfD of becoming the largest opposition party. It will allow the Social Democrats to rebuild, which means that Schulz and the older generation will sooner or later have to give way to a younger generation of politicians.

The same too can be said about the Christian Democrats.

Merkel, like most leaders, never groomed a successor. But the party’s disappointing results will almost certainly prompt, at some stage, a debate about the future direction of the Christian Democrats and its sister party in Bavaria, the Christian Social Union party.

Merkel’s policies irked both the CDU and the CSU. The conservative bloc was uncomfortable with her refugee policy, her support for the minimum wage, her abandoning nuclear power, and the way she tried to modernize the party by shifting it to the center. But because she could lead them to victory and because dissent was not tolerated inside the bloc, they went along with her policies.

This could change.

The CSU had an historic low, too. The reason is that the CSU was traditionally the accepted party of the “soft” far right. This is no longer so. Yes, the CSU remained the largest party in Bavaria, but the AfD came in third. Once the dust settles, expect a major discussion inside the conservative bloc about its political orientation and by implication, its leadership.

Finally, this election confirmed the polarization of the country. In four of the Eastern German states, the CDU came in first and the AfD came in second place. It used to be the case that Die Linke or the SPD would come in first or second. But no longer. And in the eastern state of Saxony, the AfD pushed past the CDU into first place.

In a nutshell, Germany’s status quo and its postwar consensus have been dented. Merkel cannot but respond to these shifts by turning her attention to post-election Germany.