Since Monday, anti-capitalist activists, environmentalists and other anti-globalisation groups have been flocking to a counter-summit in southwestern France that organisers insisted would be peaceful.
More than 9,000 anti-G7 protesters took part in the largest protest on Saturday — a mass march over a bridge linking France and Spain that took place without incident.
However the atmosphere was more hostile in Bayonne, where hundreds of protesters chanting anti-capitalist slogans did not seem to follow a route, instead wandering the streets trying to find a way into the city centre.
However the police, who were deployed en masse in the city, put up a barricade blocking their path.
The protesters tried to get through the barricade and police faced them down for more than an hour, according to AFP journalists.
The angry crowds were eventually dispersed in the evening after the police used tear gas and water cannon.
While several people were detained, the local authorities have yet to announce the number of arrests.
The larger, peaceful march took place in the French coastal town of Hendaye, about 30 kilometres (18 miles) from Biarritz, with police giving a figure of 9,000 but organisers saying as many as 15,000 people turned up.
Biarritz is a popular tourist destination that would normally be basking in its annual summer boom, but with US President Donald Trump and other world leaders flying in for three days of talks, the resort was in lockdown.
“Heads of state: act now, Amazonia is burning!” read one banner as the huge crowd rallied under cloudless blue skies in Hendaye, the slogan referring to the wildfires ravaging the world's largest rainforest.
“If the climate was a cathedral, we would already have saved it,” read another, referring to Notre-Dame in Paris, which was ravaged by a fire in April that prompted donors to pledge 850 million euros to rebuild it.
Waving thousands of flags, they marched across the Bidassoa River heading for the Spanish town of Irun, chanting slogans while some played drums.
The colourful crowd was an eclectic mix of environmental activists, families, anti-globalists, a handful of anti-government “yellow vest” protesters and Basque nationalists, AFP correspondents said.
“We are very happy because it was a huge challenge,” said Sebastian Bailleul of Alternatives G7, one of the march's organisers.
But authorities remain on high alert, with Biarritz in lockdown.
“I want to call for calm and for unity,” French President Emmanuel Macron said in an address to the nation just before the opening of the summit, where world leaders were to address the Amazon crisis along with other global issues.
Overnight, 17 people were arrested and four police lightly injured when skirmishes erupted near in Urrugne, a village some 25 kilometres south of Biarritz.
Friday night's confrontation occurred as activists tried to block police from a site where they had set up camp, with police firing tear gas and using controversial rubber rounds known as LBDs to disperse them, AFP correspondents said.
France has deployed more than 13,000 police and gendarmes to secure the event amid fears of disturbances by radical anti-capitalist groups, anarchists or the yellow vest protesters.
But the demonstrators insisted their aims were peaceful.
“It's important to show that people are mobilised and do not accept the type of world they're offering us,” said Elise Dilet, a 47-year-old activist with Bizi, a Basque anti-globalisation group.
A raft of unprecedented security measures has been put in place for the summit, with the picturesque Grand Plage beach off-limits to everyone except delegates and those accredited for the summit.
Earlier this week, police arrested three German activists carrying a tear
gas canister, an icepick and wrenches along with documents “linked to the
extreme left”, prosecutors said.
They were charged with planning violence, sentenced to several months prison and banned from returning to France.
Another German national was arrested early Wednesday and deported, since French authorities had banned him over “violent actions” at a previous G20 meeting, legal sources told AFP.
In anticipation of trouble, France has set up a special magistrates' court, with 17 prosecutors and 70 lawyers on hand, as well as holding cells with capacity for 300 people for anyone caught breaking the law.