The Social Democrats and chancellor Angela Merkel’s Christian Democratic Party have emerged from Berlin state elections as the strongest two parties – but it came amid significant gains for the country’s far-right AfD party.

Both main parties lost enough support to ensure they will not be able to continue a coalition government together, according to exit polls on Sunday.

The SPD won 23 per cent of the vote, dropping 5.3 per cent, while the CDU won 18 per cent, down 5.4 per cent, ARD public television reported.

The anti-immigrant nationalist Alternative for Germany party won 11.5 per cent of the vote, behind the Greens and the Left party, each with 16.5 per cent, but with more than enough to enter Berlin’s state parliament, its 10th nationwide.

The vote comes two weeks after Mrs Merkel’s CDU came in third in the eastern state of Mecklenburg-Western Pomerania, and Sunday’s showing – her party’s worst in the capital – will keep up the pressure on the chancellor a year ahead of national elections.

Syrian refugee kills woman and injures two others with machete

The AfD has campaigned heavily on the migrant issue, playing to voters’ fears about the integration of the roughly 1 million migrants who entered Germany last year.

“From zero to double digits, that’s unique for Berlin. The grand coalition has been voted out – not yet at the federal level, but that will happen next year,” said AfD candidate Georg Pazderski to cheering supporters after the results.

In pictures: Life on board a refugee rescue ship Show all 10 1 /10 In pictures: Life on board a refugee rescue ship In pictures: Life on board a refugee rescue ship Refugees sleep on the deck of MV Aquarius Alva White/MSF In pictures: Life on board a refugee rescue ship An overcrowded rubber vote before a rescue by the MV Aquarius Alva White/MSF In pictures: Life on board a refugee rescue ship Young boy being rescued from a rubber boat by the MV Aquarius Isabelle Serro/SOS Mediterranee In pictures: Life on board a refugee rescue ship The rescue of a wooden boat with more than 400 peopl on board by the MV Aquarius on 21 August Isabelle Serro/SOS Mediterranee In pictures: Life on board a refugee rescue ship Women rescued on MV Aquarius approaching Italy in the early morning Alva White/MSF In pictures: Life on board a refugee rescue ship Crew on the MV Aquarius search for a missing boat Alva White/MSF In pictures: Life on board a refugee rescue ship Rescue on the 21st August of a wooden boat carrying more than 400 people and a rubber boat with 120 people crammed on board. Ferry Schippers/MSF In pictures: Life on board a refugee rescue ship The night rescue of 124 people after they had been on the water for 20 hours by the MV Aquarius Peter Eickmeyer/SOS Mediterranee In pictures: Life on board a refugee rescue ship The MV Aquarius rescue vessel operated by Doctors Without Borders (MSF) and SOS Méditerranée in the Mediterranean Sea Alva White/MSF In pictures: Life on board a refugee rescue ship Jacob Goldberg, MSF's team leader on board the MV Aquarius rescue ship Alva White/MSF

However, it was largely local issues that drove the vote in the city of 3.5 million people.

Disillusionment is high over the capital’s notoriously inefficient bureaucracy and issues such as years of delays in opening its new airport.

Peter Tauber, the Christian Democrats’ general secretary, blamed Social Democratic mayor Michael Mueller for turning voters against the two governing parties, saying, “the fish stinks from the head”.

Mr Mueller, however, said after the results that “we have achieved our goal”.

“We are the strongest political party and we have a mandate to form a government,” he said.

Without enough support for the governing SPD-CDU “grand coalition” to continue, the most likely new governing alliance appeared to be a combination of the SPD, Greens and Left party.