KAMPALA (Reuters) - Ugandan police fired tear gas to disperse a demonstration in the capital Kampala on Monday and military units were deployed as unrest escalated over the beating of detained lawmakers.

Local television pictures showed demonstrators setting up bonfires and barricades on the second day of protests on Kampala streets, and police and soldiers tried to remove the roadblocks.

Gunfire rang out sporadically in parts of the city, two witnesses told Reuters.

Tension has been running high in Uganda since the detention of five lawmakers critical of President Yoweri Museveni.

They were arrested on Aug. 13 on suspicion of taking part in the stoning of a presidential convoy during a parliamentary by-election campaign in which car windows were smashed.

Two of the lawmakers were badly beaten while being detained, according to a lawyer for one of them. The European Union condemned their treatment.

The government denies security personnel deliberately beat anyone.

Police spokesman Emilian Kayima told a news conference on Monday police and soldiers deployed to quell a riot in a downtown Kampala market, adding that violence had erupted in at least three separate parts of the city.

“Police intervened quickly together with the military to return calm and stabilize the situation,” he added. “We condemn the perpetrators of this violence.”

A total of 68 suspects had been arrested during two days of disturbances, he said.

Among those demonstrating were supporters of Robert Kyagulanyi, a musician-turned-lawmaker who goes by the stage name Bobi Wine, who has built up a large youth following with his lyrics’ biting criticism of Museveni’s government.

Protesters and opposition supporters see the alleged mistreatment as part of a pattern of repression by Museveni’s government, an allegation it denies.

They accuse Museveni, in power since 1986, of stifling dissent through intimidation, beatings, detentions and prosecutions on trumped-up charges.

Critics say the veteran leader is set to rule Uganda for life after parliament removed a constitutional age limit that would have barred him from seeking re-election in 2021 - the year the East African state hopes to begin oil production.

Museveni and his backers say he enjoys genuine mass support. He also has won Western support for providing Ugandan forces for an African peacekeeping force in Somalia that is fighting al Qaeda-linked al Shabaab Islamist movement.