Ugandan presidential candidate Bobi Wine has been released on bail after being charged with spreading coronavirus.
The court ruled on Friday after Mr Wine, 38, held a large rally this week.
Human rights groups say the virus charge is a pretext to suppress political opposition ahead of the 14 January election.
Protests broke out and 37 people died in clashes when the politician, also a pop star, was arrested this week.
The musician, whose real name is Robert Kyagulanyi, is among 11 candidates challenging President Yoweri Museveni, who has been in power since 1986.
Human Rights Watch says it is clear that the Ugandan authorities are using Covid-19 guidelines to repress opposition and that the governing party has held large campaign events.
In June Bobi Wine vowed to defy a ban on holding campaign rallies during the pandemic. He accused President Museveni of “fearing the people”, suggesting the prohibition was motivated by politics.
Uganda shocked by violence
Patience Atuhaire, BBC News, Kampala
Bobi Wine seemed quite contemplative as he listened from the dock while the charges were read.
After two days in detention, his lawyers were finally granted access to him.
He was charged for contravention of the public health act, an offence that attracts up to seven years in prison.
The court premises were surrounded by heavily armed security personnel.
The aggressive police response to this week’s protests has shocked the country.
It is the worst violence to erupt on the streets of Uganda since Bobi Wine was nominated as a presidential candidate.
Bobi Wine’s arrest on Wednesday outraged his supporters. Groups of young people set up barricades, burnt tyres and piles of rubbish in the streets of the capital Kampala and other towns.
Following the unrest, the authorities have increased security. They say soldiers will be placed at major roads leading into Kampala and a 21:00 curfew will be strictly enforced.
During the more than three decades that President Museveni has been in power, he has routinely been accused of using violence against his political rivals. He has always denied such charges.