Sheikh Yusuf Mohammad Siad had been visiting the Ugandan capital when seized.
“We quickly realised he was a minister,” Mugira told the AFP news agency. “It was not a kidnapping.”
Uganda’s military makes up about half the African Union peacekeeping force in Somalia, and both countries are allied against Somalia’s rebels.
Siid Ahmed, Somalia’s ambassador to Kampala, confirmed Siad was in Ugandan custody and told the Reuters news agency that the Somali government was seeking more details about the incident.
“We want to know what happened, but it seems to have something to do with legal papers,” he said.
A powerful Mogadishu warlord and former member of Islamic Courts Union which briefly took control in 2006, Siad is now a key member of Somalia’s internationally-backed transition government that is battling rebels.
Siad’s disappearance had earlier sparked fears he may have been abducted by fighters or a foreign intelligence service.
A Ugandan military spokesman said Siad was picked up because of “unclear reasons” for visiting Kampala.
“It is true. He is in our hands. He came here for unclear reasons and we picked an interest in him,” Lieutenant-Colonel Felix Kulayigye told Reuters.
“You can’t come here as a high profile person without notice.”
Somalia has been ravaged by violence and anarchy since regional commanders overthrew Mohamed Siad Barre, the then president, in 1991, before turning on each other.