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 parliament buildings in the Swiss capital.
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.
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 organizers lack a permit.
The organizers 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 heavyhanded policing.
Organizers had appealed for the violent few to stay away.
The 2012 edition drew some 20,000 people. Bern'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, Bern 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, an 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 Bern'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.