A Ugandan pop star-turned-lawmaker who opposes the longtime president was charged with treason in a civilian court on Thursday, minutes after a military court dropped weapons charges.

The new charge was bound to bring fresh outrage from Ugandans and global musicians after Kyagulanyi Ssentamu, also known as Bobi Wine, alleged he had been severely beaten while in detention. The government denies it.

Mr. Ssentamu has emerged as an influential critic of President Yoweri Museveni, especially among youth, after winning a parliament seat last year.

The 36-year-old had been charged last week with illegal possession of firearms for his alleged role in an incident in which Museveni’s motorcade was pelted with stones. A military court freed him Thursday but the lawmaker was re-arrested by police and taken to a magistrate’s court. He was remanded until Aug. 30.

The lawmaker had been arrested with four other opposition lawmakers, three of whom also face treason charges. A fifth legislator has been hospitalized with injuries allegedly sustained during detention.

Mr. Ssentamu’s appearance on Thursday was the first time he had been seen in public since his detention.

In recent days Uganda’s government has faced mounting pressure at home and abroad to free him. Security forces have violently put down street protests demanding his release.

On Thursday, other opposition figures expressed concern about being targeted by security forces. “Every way out of my home is barricaded since very early today,” Kizza Besigye, a four-time presidential challenger who has been jailed many times, tweeted.