HANOVER, Germany (Reuters) – Members of the anti-immigrant Alternative for Germany (AfD) party elected a right-wing nationalist to be their co-leader on Saturday, signaling a possible toughening of tone before regional votes next year.

A party congress chose Alexander Gauland – who once defended an AfD member who had said history should be rewritten to focus on German victims of World War Two – to return to the post he had held until 2015.

As members deliberated, thousands of anti-AfD protesters marched outside carrying placards reading “Hanover against Nazis” and “Stand up to racism”.

Earlier, riot police fired water cannon at dozens of protesters who blocked a road leading to the congress, underlining the divisive impact the party has had since it entered the Bundestag lower house for the first time in a Sept. 24 election.

The party’s incumbent leader Jorg Meuthen – seen as a relative moderate in the movement – won enough votes to keep his post.

But in a vote that dragged into the evening, he was joined as co-leader by Gauland, who ran for the post at the last minute after another candidate seen as a moderate, Georg Pazderski, failed to win enough votes.

Before the leadership vote, Meuthen praised the party often beset by internal strife for showing unity after two senior members quit in September in protest against what they saw as an unstoppable populist streak.

“There are people in this country who don’t only say ‘We can do this’ but who actually manage to do something,” Meuthen told delegates, putting a new twist on Chancellor Angela Merkel’s “Wir schaffen das” (We can do it) message to those who doubted Germany can deal with a record influx of migrants in 2015.

VOTES NEXT YEAR

As thousands of protesters marched peacefully outside, AfD delegates watched a short film that painted a gloomy picture of Europe’s largest economy being overrun by beggars, stone-throwers and Muslims.

Founded in 2013 as a vehicle to oppose euro zone bailouts, the AfD was polling at around 3 percent nationally two years ago on the eve of the refugee crisis.

The arrival of more than 1.6 million people seeking asylum in the two years to the end of 2016 has helped it morph into an anti-immigrant party that now has seats in 14 of Germany’s 16 regional parliament.

Polls suggest it will win seats in next year’s regional elections in the southern state of Bavaria and the western region of Hesse, which would give it a foothold in all of Germany’s state parliaments.

Gauland replaces Frauke Petry, who quit to become an independent member of parliament.

Her sudden departure two days after the AfD became the first far-right party to win seats in the Bundestag since the 1950s exposed rifts over whether the party should ditch rhetoric including statements saying Islam was not compatible with the German constitution.