HAMBURG, Germany — Every Western democracy struggles with the contradictory demands of permitting free expression and maintaining public order. In Germany, the experience of Nazism and Communism highlights the clamor for free speech and how best to protect it.

The violence that marred the Group of 20 summit in Hamburg last week clearly caught the authorities off guard, despite the deployment of more than 20,000 police officers called in from across Germany and its European neighbors. It has opened a searing if familiar debate about who was to blame for the loss of control in some areas where large groups of people expressed their anger at the global political and economic system.

Leftists held the police responsible, not the peaceful protesters, and insisted that guaranteeing nonviolent demonstrations was a basic tenet of German democracy enshrined in the Basic Law, Germany’s 1949 constitution, and upheld by important court rulings over the years.

Equally predictably, conservatives blamed troublemakers for the clashes in Hamburg where they said well-organized vandals disguised themselves as “clash tourists.”