Police face off against demonstrators Tuesday during an anti-capitalist protest in Athens.

Story highlights

NEW: President Barack Obama talks about democracy in a speech near the Acropolis

Police: Anarchists became violent after they tried to break through a police cordon

Athens, Greece CNN  — 

Six people have been arrested in the Greek capital after a group of anarchists started throwing rocks and Molotov cocktails following an anti-capitalism protest, Athens police told CNN.

The trouble came as Barack Obama visits Athens on his final state tour as President of the United States. He gave a speech Wednesday after touring the Acropolis, the complex of monuments known as the “cradle of democracy,” in which he said democracy was “complicated” and “messy” but designed to correct mistakes.

Protesters stand in front of graffiti that reads "No Hope" on Tuesday in Athens.

The arrests occurred Tuesday after a peaceful demonstration, organized by the Communist Party and permitted by police, in Omonia Square near central Athens.

About 5,000 people attended the anti-establishment protest, police said. After it was over, a group of some 100 to 150 anarchists became violent, police said.

Police look at flames from a fire bomb thrown by demonstrators Tuesday.

Unrest broke out as the group tried to break through a police cordon to march to the US Embassy and Presidential Mansion, where Obama was attending an official state dinner.

Protesters threw Molotov cocktails, and police responded with stun grenades and tear gas, dispersing the crowds who eventually retreated into the side streets.

Three officers suffered minor injuries, police said.

Obama warns of ‘crude nationalism’

On Tuesday, Obama gave a news conference alongside Greek Prime Minister Alexis Tsipras in which he warned against “crude nationalism” in the wake of Donald Trump’s victory in the US presidential election last week.

Obama said countries across Europe as well as the United States were confronting populist movements based on a fear of intruding global forces, arguing people “are less certain of their national identities or their place in the world.”

He said leaders should heed lessons from election results in the United States and in Britain, which voted in June to exit the European Union.

Obama is on a weeklong, three-stop foreign trip that will also take him to Germany and Peru.

Journalist Barbara Arvanitidis reported from Athens for CNN, and CNN’s Laura Smith-Spark wrote in London. CNN’s Kevin Liptak contributed to this report.