A security source, speaking on condition of anonymity, said officers had found what appeared to be an Islamist radicalisation centre inside the mosque.
The discovery came Friday evening as police offices followed a suspect, believed to have been involved in a high-profile kidnapping and murder earlier this year, into the ramshackle Usafi mosque.
During an ensuing shoot-out, police said one officer was wounded, two men were shot dead and 36 arrested and accused of hoarding weapons.
Also inside the mosque were 18 women and 94 children that police said were being held against their will.
“A number of children and women, suspected to either have been kidnapped or held hostage, were rescued,” police spokesman Emilian Kayima told a news conference on Saturday.
“Two of the hostage-takers were shot dead after violently attacking and severely injuring one of the security officers,” Kayima said, adding that the man who police had followed into the mosque was taken into custody.
Investigations into the connection between the original suspect and those found inside the mosque were continuing.
At the scene, in a particularly poor part of the city, bullet holes pocked the collection of corrugated tin lean-tos and tarpaulin sheets that constitute the mosque, situated in a low-lying area between a bus station and a shipping container park.
Police had cordoned the area, blocking curious residents and passersby.
– ‘Scared and traumatised’ –
Local council official Hassan Kiberu heard the gunshots that ripped through the neighbourhood on Friday evening. “I’ve never been in that mosque before. The people who went there didn’t allow anyone in,” he said.
Kiberu said the mosque’s leader was arrested a month ago, after complaints from neighbours who suspected him of disseminating extremist messages. “I think they were grooming those kids in there for something,” he said.
The men arrested Friday — who police said were found with 23 machetes, 60 bullets and a bow and arrow — are suspected of involvement in the kidnapping and illegal detention of the women and children who come from various East African countries.
In February, the body of Susan Magara — a member of an influential Ugandan family — was found three weeks after her abduction and a string of ransom demands.
The crime shocked Ugandans and president Yoweri Museveni ordered intelligence agencies to lead an investigation.
Security forces believe that a key suspect who they had under surveillance realised he was being followed and bolted into the mosque.
Interior Minister Jeje Odong said officers chased the suspect into the mosque and that the subsequent discovery of weapons, women and children was not “planned or intended”.
“If the suspect had not gone into the mosque we would have had no reason to enter,” Odong said. “We take strong exception to places of worship being used to commit crime.”
Odong said the children discovered inside “looked scared and traumatised” and appeared to be from Burundi, Rwanda and Kenya as well as Uganda.