Berlin (AFP) - Protests broke out in several German cities against the anti-immigration Alternative for Germany which became the first nationalist party to win dozens of seats in parliament since World War II.

Hundreds of people gathered in front of a club where the AfD was celebrating in central Berlin, shouting "Nazis out" and "all of Berlin hates the AfD".

Mathias, who said he turned up after seeing a call on Facebook, said it was "important to show that it's not acceptable here in Germany for such a party to enter parliament."

He added that Germany's two biggest parties -- Chancellor Angela Merkel's Christian Democratic Union and the Social Democratic Party -- "must reflect on how it can be that so many people voted for such racist politicians".

Dozens of police officers blocked off the club's entrance and made a handful of arrests over "small incidents," a police spokeswoman said.

Smaller protests were held in other German cities, including Cologne in the west, where around 400 people gathered, and in the northern port city of Hamburg, where demonstrators were marching towards the party's local headquarters.

Germany's financial hub Frankfurt also saw protests.

Preliminary results credited the AfD with around 13 percent of the vote, making it the third biggest political force in Germany -- a stunning result for a party that was founded just four years ago.

The AfD began life in 2013 as an anti-euro protest party but then shifted focus to capitalise on misgivings over the record migrant influx in Germany.

Its tone turned increasingly extreme in the last stretch of campaigning, with one of its two leading candidates saying Germany should be proud of its war veterans and claiming that terror was grounded in Islam.