Authorities said a gunfight broke out after police were shot at while preparing to enter Vila Cruzeiro, an underprivileged community where leaders of an alleged criminal group were suspected to have gathered.
In an official note released by its press office on Tuesday night, Rio's military police said that although "necessary," the raid could not be considered successful given the loss of life.
"It is not possible to consider a success an operation that resulted in death," the statement read.
In an earlier press conference, Rio de Janeiro Military Police Secretary Luiz Henrique Marinho Pires had said the operation was spurred by "criminal migration" into the neighborhood, which he said houses drug traffickers from other states.
After the raid, Vila Cruzeiro residents gathered at the top of the hill where the shooting took place to look for corpses, according to local activist Raull Santiago. Schools and public health services also closed as a result of the raid, the city's education secretary said.
The raid took place despite a June 2020 ban by the Brazilian Supreme Court on anti-drug operations in Rio de Janeiro's densely populated slum areas other than in "absolutely exceptional" circumstances during the coronavirus pandemic. The ruling was designed to avoid further straining public health and humanitarian services.
The press office of Getulio Vargas Hospital told CNN that 21 people arrived dead at the hospital after the raid, and six others were admitted with injuries.
Pires said the anti-raid ruling had attracted alleged criminals to poor communities.
"Making this (community) their hiding place is a result of the decision," he said during the press conference.
Police raids in Rio de Janeiro regularly result in high death tolls, drawing sharp criticism from human rights defenders.
A May 2022 study by researchers at Brazil's Fluminense Federal University (UFF) found that from 2007 to 2021, police raids in Rio de Janeiro led to three mass killings -- where at least three people are killed -- per month in underprivileged communities.
A total 2,374 people died during police raids in that period, according to the UFF data.
Tuesday's raid marks the second deadliest of its kind in the city's history, according to the UFF. The deadliest operation, carried out by security forces in Rio de Janeiro's Jacarezinho neighborhood, left 28 dead in May 2021, according to the university.