Kyagulanyi is facing charges of illegal possession of weapons, following his arrest after the motorcade of longstanding president, Yoweri Museveni, was attacked by people throwing stones.
Kyagulanyi, who is also a politician, is being tried under military law because investigators say they found two guns in his hotel room. His wife insisted he doesn't know how to handle a weapon, AP reported, and rights activists demanded his release.
His lawyer, Asuman Basalirwa, told DW on Thursday morning he will challenge the government's decision to hold a court martial.
"It is our considered view that civilians have no business in the court martial, the court martial should really be an exclusive preserve for people in the military," he said before the military hearing in the northern town of Gulu on Thursday.
The lawmaker has not been seen in public since his arrest, and many were worried about his safety after Uganda's deputy prime minister told lawmakers Kyagulanyi had been hospitalized in custody, without giving details.
Kyagulanyi's next hearing is due on August 23.
Why was Kyagulanyi arrested?
Kyagulanyi had been campaigning in the northwestern town of Arua on behalf of the opposition candidate, Kassiano Wadri, in a by-election.
President Museveni was also in Arua to support the ruling party candidate.
Police said Kyagulanyi was arrested for obstructing the presidential motorcade, during which a windscreen was damaged on one of the official vehicles. The president was not in the convoy when it was attacked.
In the ensuing scuffle, police fired live rounds in an attempt to disperse the crowd, killing Kyagulanyi's driver, Yasin Kawuma.
Three other politicians, among them opposition lawmaker Francis Zaake, and at least 34 others were also arrested after stones were thrown at the president's convoy late on Monday in the same area, according to a police spokesman.
A number of journalists covering the event were also arrested without clear cause.
Kyagulanyi took to Twitter shortly after the attack to claim he may have been the intended target of the shooting.
"Police have shot my driver dead thinking they've shot at me. My hotel is now cordoned off by police and SFC," Kyagulanyi wrote on Twitter alongside a photo of his driver slumped in the car's front seat.
Kyagulanyi's assistant, Sheriff Najja, says the lawmaker was picked out of the crowd by authorities after the incident and quickly separated from other people during the chaos. Najja is also skeptical over the apparent randomness of the shooting.
"Why would someone be shot in a car which is parked outside the hotel?" he told DW. "If the car was moving it would create an impression that he may have committed a crime and was running away, but the car was parked at the hotel."
In a post on Facebook, Kyagulanyi's wife, Barbie Itungo, says she tried to reach her husband in vain as all his phones were unreachable.
Kyagulanyi has apparently been targeted previously — his home came under attack on October 3rd last year when two grenades exploded. However, no one was injured and no arrests were made.
Who is Kyagulanyi exactly?
Kyagulanyi is a popular musician in Uganda and won a parliamentary seat last year after beating two seasoned candidates. He is considered by many to be one of the strongest threats to Museveni's 32-year grip on power, according to political analyst Adolf Mbeine from Makerere University in Kampala.
"There has been talk in the last few months that he wants to offer himself as a presidential candidate when the next election [comes around]," he told DW. "He's young, he's famous, I think he's also intelligent and, crucially, I think a lot of younger people will side with him. But we don't know if he is going to aspire for higher political office where he will be a direct threat to Museveni's bid to hold on to power."
Is this incident unusual in Uganda?
The attack in Arua is just the latest example of all-too-common violence against Ugandan lawmakers.
The by-election was triggered by the still-unsolved murder of ruling party MP Ibrahim Abiriga, along with his personal bodyguard in June.
In July, Museveni approved increased security spending for Uganda's 456 members of parliament — including the use of sharpshooters and armored escort vehicles.
At the time of the decision, the opposition and number of rights groups accused the government of wasteful spending and failing to tackle corruption as the main cause of the violence.
Mbeine believes that although politicians themselves may be targeted, ordinary Ugandans are also paying the price.
"Violence doesn't discriminate against people," he told DW. "The by-election is [on Wednesday] but unfortunately some people have already died and others are injured. There is so much tension in the area. I don't think that is good for the country at all."
Human rights watchdog Amnesty International has criticized Uganda over the arrests of the opposition lawmakers and the use of the military court system.
"The Ugandan authorities must not attempt to intimidate the oppostion by dragging these MPs through the military court system, which does not have competence to try civilians," Amnesty said.
Taking a step back from 'micro-political' campaigns
Ugandan policy analyst, Godber Tumushabe, says Museveni's involvement in low-level campaigns and by-elections puts ordinary citizens' security at risk even further.
"The handlers of the president may need to take a step back and pull him out of these micro-political situations," he told DW. "You can't keep running around the country doing a by-election here and there."
Adolf Mbeine agrees that Museveni's presence can contribute to heightened tensions.
"There is a strange practice here that whenever there is a special by-election, the president campaigns for the candidate of his party," he says. "But it seems a bit odd to me that the president goes to campaign for candidates who are not in his constituency because that brings with it quite a bit of tension because the security is heightened."
Corruption remains a big issue
Prominent Ugandan human rights lawyer, Nicholas Opiyo, took to Twitter to express his dismay over the unfolding situation and the lack of transparency in the country's electoral process.
Mbeine says the biggest issue is the lack of independent institutions combined with an increasingly partisan police force.
"I think a lot of people are beginning to get frightened because Museveni has been in power for the last 32 years, going on to 33, and over time we've seen groups of people speaking out against the regime," he told DW. "I don't know when this will end, but we are not heading for better times."
Alex Gitta contributed to this report