The picturesque heart of Switzerland's capital Berne was shrouded in tear-gas as police fought back protesters at a politically-tinged techno parade.
After a tense stand-off between riot police and dozens of masked and hooded "Black Bloc" hardliners, a group attempted to break down hastily-erected barriers protecting the Alpine country's parliament.
Police responded with tear gas, as a water cannon sent the crowd scattering across the Bundesplatz, or parliament square, and a helicopter circled overhead.
Some protesters held their ground, pelting the water cannon and police with bottles and fireworks.
The hardliners are traditionally wary of what they see as the mainstream media, and several approached by AFP bristled, shouting "Get lost!"
A police spokesman declined to give immediate details of any arrests.
The troublemakers represented a minority of what police told AFP was a 7,000-strong turnout at the "Tanz Dich Frei" (Dance Yourself Free) parade, organised by an anonymous collective which mustered participants on Facebook.
The event, now into its third year, is tolerated grudgingly by city authorities even though the organisers lack a permit.
The organisers say that the right to party at will is as much a cause as the other issues they push, including opposition to the gentrification of parts of Berne which they claim has driven up property prices and created a sanitised city where the alternative scene is unwanted.
They also push an anti-capitalist message, blasting neo-liberal economics, commercialism and heavy-handed policing.
Organisers had appealed for the violent few to stay away.
"Help one another, keep your alcohol or drug use under control and organise your fights somewhere else. That way, we'll show the police and the authorities we can organise a successful event without them," they said on Facebook ahead of the event, which started late Saturday.
The 2012 edition drew some 20,000 people. Berne's population is around 126,000.
Hardliners managed to spray-paint parliament last year, and the authorities were taking no chances this time, with police were deployed at strategic points across the Old Town district.
Despite being bolstered by other cities' forces, Berne police were stretched by the techno protest, which followed Monday's trouble at the Swiss football cup final, the security operation for Friday's visit by Chinese Premier Li Keqiang, and ahead of a high-tension football league match on Wednesday.
Braving rain and unseasonably chilly weather - temperatures fell to nine degrees Celsius after nightfall - the eclectic crowd ranging from anarchopunks to fashionistas wound through the city among trailers carrying huge speakers that pumped out dance beats.
"It's about having fun, without violence, and letting your heart do the talking," said a samba group leader called Adrian, who declined to give his surname.
"It's a mix of music and politics. The system divides us in many ways, and this is a way to come together," he told AFP.
Ahead of this year's rally, officials warned that peaceful partygoers risked getting caught up in trouble.
They also expressed concern that, given the organisers' decision to go it alone without liaising with the authorities, emergency services struggled to plan for a worst-case scenario.
"Ever since the tragic incident in Duisburg, it should be clear that such large crowds pose a risk," said Berne's security chief Reto Nause, referring to a stampede at the 2010 Love Parade in the German city which claimed 21 lives.
Organisers accused officials of trying to stoke fears.