Musician-turned politician Robert Kyagulanyi alias Bobi Wine is at the Makindye military prison near Kampala

Ugandan pop star-turned-government critic Bobi Wine was freed on bail Monday.

The 36-year-old lawmaker, whose real name is Kyagulanyi Ssentamu, has been in detention since August 14.

Ssentamu was released by a judge in the northern Ugandan town of Gulu. He was freed alongside others who are similarly charged with treason for their alleged roles in an incident in which the presidential motorcade was pelted with stones.

Ssentamu was on crutches as he entered the courtroom. An ambulance was on standby to transport him and others after winning bail.

Ssentamu was initially charged before a military court with illegal possession of firearms and ammunition. Those charges were later withdrawn.

Ssentamu’s arrest came after he was campaigning on Aug. 13 in an election to choose a lawmaker in the northwestern town of Arua.

Ugandan President Yoweri Museveni also was in Arua at the time, campaigning for a rival candidate who eventually lost.

While the president was departing, authorities said, his motorcade was pelted with stones by people associated with Ssentamu and the candidate he backed, Kassiano Wadri. Ssentamu’s driver was shot and killed, allegedly by security forces.

Authorities have been under pressure to free Ssentamu, who is challenging the long rule of Museveni.

The jailing of Ssentamu has drawn street protests at home as well as outrage from top musicians around the world.

Ssentamu has alleged severe torture while in detention.

“These people should never have been tortured, should never have been terrorized,” said Kizza Besigye, a four-time presidential contender who witnessed court proceedings Monday.

At least two of Ssentamu’s co-accused fainted during court proceedings, and one of them had required resuscitation, Besigye told reporters.

The government denies the allegations of torture.