General David Sejusa, a former intelligence chief who has emerged as a potential challenger to veteran President Yoweri Museveni, has been detained in order to "enforce discipline", a government spokesman said.
"His conduct since his return from self-imposed exile has been contrary to what is expected of a serving military officer, and the days when army officers acted with impunity are gone," government spokesman Ofwono Opondo said.
"The terms of his returning from exile were that he become a law abiding citizen until the army retires him from service as per his wish, but he has reneged on that," he added.
General Sejusa was once one of Uganda's top military bosses, serving as intelligence chief and as a close advisor to President Museveni, who has been in power since 1986.
He left the country in 2013, after a confidential memo he wrote was leaked to the press, causing a political storm.
The memo claimed Museveni was grooming his son, special forces commander Muhoozi Kainerugaba, to succeed him and that those in the army opposed to the supposed succession plan risked being assassinated.
While in exile in Britain, General Sejusa formed the Freedom and Unity Front Party, marking himself as a direct challenger to Museveni. Speaking to reporters outside Sejusa's house in an upscale Kampala suburb, his lawyers, David Mushabe and Michael Mabikke, vowed they would wage "a protracted legal battle to rescue" their client.
"This is illegal confinement. You cannot deny him his basic needs like water and groceries. Nobody is allowed in or out," Mushabe said. The move comes as Museveni has set about campaigning for presidential elections in 2016, which will be his 30th year in power.
Museveni, 70, has already been chosen as the ruling National Resistance Movement's (NRM) candidate for the elections, but there have been increasing murmurs of discontent within some sections of the party.