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

During a speech at a town hall event for the Obama Foundation in Berlin, Mr Obama discussed the need for compromise in politics, citing his Affordable Care Act as something that he thought was emblematic of progress even if it didn’t achieve all of his ambitions for US health care, the New York Post reported.

“The way we structure democracy requires you to take into account people who don’t agree with you,” he said. “And that by definition means you’re not going to get 100 per cent of what you want.”

“One of the things I do worry about sometimes among progressives … 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,” he sad.

Mr Obama began his political career in Chicago before as an Illinois state senator and, later, a US senator. He recalled the frustration he experienced when politicians told him they couldn’t deliver as much progress on an issue as he would have liked to see.

He then went on to say that his perspective changed throughout his political career.

"You should take some time to think in your own mind and continually refine and reflect, 'What are my core principles?' Because the danger is if you don’t know what your principles are, that’s when you compromise your principles away," he said.

"You can’t set up a system in which you don't compromise on anything, but you also can’t operate in a system where you compromise on everything."

Seventeen Democrats have announced they are running for the party’s presidential nomination in 2020, and more are expected to enter the race.