The United States, which gives financial support to Uganda and helps train its military, was among those condemning the brutal actions. It occurred as voting from Thursday's election proceeded in two main districts on Friday because ballots and other election materials had not arrived as scheduled on election day.
Early returns put Museveni ahead of opposition leader Kizza Besigye, but votes remained to be cast, and counted, in Besigye strongholds.
With results from about 23 percent of polling stations across the country counted, Museveni had 62 percent of the vote and Besigye had 33 percent, the election commission said.
Police surrounded the headquarters of Besigye's Forum for Democratic Change party as he was meeting with other leaders of his party, and a helicopter fired tear gas at a crowd outside. Then police moved in and took Besigye, a 59-year-old doctor, to an unknown location, according to Semujju Nganda, a spokesman for the FDC.
The U.S. Embassy said on Twitter that "We strongly condemn the disproportionate police action taken today at FDC HQ in Kampala."
After Besigye's arrest, supporters who had been inside the party headquarters joined Besigye supporters in the streets. Riot police lobbed tear gas and stun grenades at them and fired warning shots from automatic rifles, then chased them through narrow alleyways, arresting some. Armored personnel carriers rumbled up and down the main street. A woman and her children fled on a motorbike.
In nearby poor neighborhoods, people set up burning barricades which riot police and military police quickly took down. Angry protesters also erected barricades of stones on the highway leading to Uganda's international airport. Police fired tear gas and whacked protesters with sticks.
Muthoni Wanyeki, Amnesty International's regional director, noted that the raid represented a "restriction on the rights to freedom as association and peaceful assembly. The security forces must act with restraint."
Police parked their trucks near the home of presidential candidate Amama Mbabazi, a former prime minister. Josephine Mayanja-Nkangi, a spokeswoman for Mbabazi, said he interpreted the deployment to mean he cannot leave his house.
The voting Thursday suffered delays in delivery of voting materials, especially in areas seen as opposition strongholds, and was seen by the opposition as deliberate. Voting was taking place Friday at 36 polling stations in Kampala and the neighboring district of Wakiso.
The government had shut down social media sites such as Twitter and Facebook but many Ugandans were circumventing that by using virtual private networks, or VPNs.
Besigye was also briefly arrested late Thursday after visiting a house in Kampala where he suspected ballot-stuffing was taking place. Police said the house was a security facility and accused Besigye of trespassing on government property.