The Alternative for Germany (AfD) sure upset the applecart during the election for Berlin’s regional parliament. On September 18, the anti-Islam and anti-immigrant party won 14.2 percent of the vote. It was the first time the AfD had stood in the German capital.

The AfD ran a campaign focused entirely on its opposition to German Chancellor Angela Merkel’s decision in 2015 to allow in hundreds of thousands of refugees. It clearly paid off.

Merkel’s decision showed the strengths and weaknesses of Germany’s ability to cope with such an influx. It also exposed big divisions at home and especially inside the European Union over how to deal with refugees, security, and the ever-increasing rise of populist parties that want strict controls over immigration.

“If I could, I would turn back time by many, many years to better prepare myself and the whole German government for the situation that reached us unprepared in late summer 2015,” Merkel told the leadership of her Christian Democratic Union (CDU) party after the Berlin poll. “Nobody, including myself, wants a repeat of this situation.”

It was a rare admission of the government’s lack of preparation for taking care of and integrating so many people—a task made even more difficult by the lack of solidarity from many other EU member states.

After the final tally in Berlin, the capital’s governing coalition of Social Democrats and Christian Democrats threw in the towel. Both parties saw their share of the vote fall by between five and seven percentage points. There wasn’t much celebrating among Green supporters either. They had to swallow a two percentage point decline.

The big winners were the AfD, the Left, built on the former East German Communist Party but now going through big demographic changes, and the Free Democrats. The latter made a surprising comeback to the city’s parliament, no thanks to its miserable campaign.

It now seems that Berlin will be governed by a coalition of Social Democrats, the Left, and the Greens, with no party daring to invite the AfD into any government. One wonders how this new political constellation will deal with a city notorious for its inefficient administration and overbearing bureaucracy.

As for coping with the 80,000 refugees who arrived in the city in late 2015, the effort has been little short of a catastrophe. The official in charge of registering the refugees, the Christian Democrat Mario Czaja, who is the Berlin senator (or regional minister) for health and social affairs, shrugged off a barrage of criticism over delays and dragged his feet over revamping the relevant departments. The enormous support from civil society and individuals who ignored the red tape to help the refugees should not be underestimated.

The governing coalition did badly for other reasons, too: the Social Democrats and the conservatives had little to say to the voters. The Social Democrats promoted the cult of personality, relying on Michael Müller, the incumbent leader of the city, to see them through and keep their position as the largest party. Which he did. But there was more relief than jubilation among the party’s supporters.

The CDU’s Frank Henkel, the senator for internal affairs, had tried to make security the big issue during the campaign. But even his party admits he was a weak candidate from the start. He resigned soon after the polls closed, leaving Merkel to ponder how Berliners will vote a year from now in Germany’s federal election.

Those CDU voters who couldn’t bring themselves to vote for the AfD cast their ballots for the Free Democrats. This party, which once stood for tax reform, a smaller state, and a more libertarian society, campaigned on one main issue: keeping Berlin’s Tegel Airport open once the big new airport currently under construction is operational. Hardly anything, by the way, was said during the campaign about the poor management, the waste, the alleged corruption, or the cost overruns of the new airport.

Aside from all the above, three conclusions can be drawn from the Berlin election, revealing much about the state of German politics today.

First, candidates didn’t bother to campaign on the doorstep. Not one party dropped a leaflet in my mailbox in Berlin. The established parties were even invisible on the streets. Merkel did the odd rally but with little enthusiasm.

Second, only the AfD had a clear message—on the refugee issue. The party campaigned hard and loud, especially in the Eastern districts of Berlin. In Marzahn-Hellersdorf, where many ethnic Russians live, the AfD romped home with 23.6 percent of the vote, making it the largest party, with the Left coming second. But the AfD also did well in comfortable Western districts such as Charlottenburg (10.3 percent) and Steglitz-Zehlendorf (11 percent). Whether these were protest votes against the coalition or a symptom of the shifting political views of the capital’s inhabitants will be known only at next September’s general election.

And third, local politics collided with national issues, as in the regional election on September 4 in the northeastern state of Mecklenburg–West Pomerania.

Indeed, the refugee issue, coupled with a sense of insecurity, is setting the agenda for next year’s federal election. Between now and then, Merkel has the difficult task of winning back disaffected conservative voters in particular and the public in general and convincing them that German society and institutions can pull through. The countdown has begun.