Clashes broke out in the Slovenian capital of Ljubljana as angry demonstrators tried to push through a police cordon to storm parliament and police used water cannon and tear gas to repel them.
At least 15 people were injured and 30 were arrested in what turned into a street battle between the police and groups of hooded young extremists throwing rocks, bottles and firecrackers at them.
This was the second time this week that anti-government protests in Slovenia turned violent - an extremely rare development in the otherwise calm Alpine nation. But tensions have been soaring before a presidential run-off vote this weekend.
Slovenia has been struggling economically and is in danger of needing an international bailout.
Thousands joined the protests in Ljubljana against prime minister Janez Jansa and his Cabinet, accusing them of corruption and fraud and demanding their resignations.
The gathering started off peacefully. Carrying banners that read "You are finished" and "Thieves", about 8,000 people braved the drizzle and cold to express their discontent with government cost-cutting measures and other reforms designed to avoid an international bailout.
Clashes erupted at the end of the demonstration after smaller groups attacked the police guarding parliament and other state buildings. Similar clashes marred the protest earlier this week in the second-largest city of Maribor.
Slovenia is facing one of the worst recessions of the 17 nations that use the euro currency. Its economy has shrunk more than 8% since 2009 and continues to decline, resulting in a sharp drop in exports and living standards and a surge in unemployment, which now stands at about 12%.
The vote pits incumbent President Danilo Turk against former prime minister Borut Pahor.
Many among Slovenia's two million people are angry with their leaders' inability to join forces and pull the country out of its economic crisis. They are also upset over austerity measures - spending cuts and tax hikes - which they say target the poor rather than the rich.