Former President Barack Obama on Saturday chided fellow Democrats for creating a “circular firing squad” that targets party members who don’t support far-left views.

“The way we structure democracy requires you to take into account people who don’t agree with you,” he said at an Obama Foundation town hall event in Berlin, Germany. “And that by definition means you’re not going to get 100 percent of what you want.

“One of the things I do worry about sometimes among progressives,” he continued, “we start sometimes creating what’s called a ‘circular firing squad’ where you start shooting at your allies because one of them has strayed from purity on the issues.”

Seventeen Democrats have announced they are running for the party’s presidential nomination in 2020, and more are expected to enter the race. Legislative proposals from the pack include free college tuition, government-run health care and reparations for slavery and segregation.

Obama also warned the town hall audience of 300 against nationalism and the “bloodshed” that can follow.

“Nationalism, particularly from the far right, has re-emerged,” he said. “And we know where that leads. Europe knows better than anyone where that leads.”

Obama met privately with Chancellor Angela Merkel Friday, in what her office called a routine get-together of former international colleagues.