Around 200 people were trapped at the top of a popular Rio de Janeiro tourist spot during a police operation in the Vidigal favela of the city, according to local media.

The trail leading to the top of Morro Dois Irmãos, well-known for its stunning views over Ipanema Beach, begins east of the neighbourhood.

Officers from the Public Prosecutor's Office of Bahia and Rio's Polícia Civil were attempting to arrest alleged members of the Comando Vermelho gang, believed to be hiding in Vidigal, broadcaster TV Globo reported.

The main access route to the trail was blocked as police and suspected gang members exchanged gunfire, leaving the frightened tourists stranded.

Video shared on social media showed the group seated on the ground as the sun rose, with a police helicopter flying overhead and gunshots audible in the distance.

Portuguese tourist Matilda Oliveiro, who was waiting to see the sunrise with her sister Rita, described the sudden escalation to chaos. We had waited for sunrise and, suddenly, the guides asked us to sit down and we started hearing gunshots, she told TV Globo.

Fortunately, the guides were well-prepared for the situation. They did their job. It's always scary, but it was controlled as much as possible. We passed the police on the way, and the situation was already under control, Oliveiro added.

After about 30 minutes, the stranded tourists were able to descend safely, according to local reports.

The guides had been informed about the police operation in advance, said Rita Oliveiro, and other local guides coordinated with police units operating in the area.

Danielly Nobre, another tourist, expressed her surprise at the gunfire, noting that the guides reassured them and a police helicopter signalled for calm. In the end, everything worked out. Everyone went down in a single file, helping each other, and we managed to finish the trail, see the sunrise, and experience that adrenaline rush, she recounted.

The Comando Vermelho gang and similar groups control various aspects of life in the favelas, extending their influence beyond drug trafficking to essential services like gas, cable television, and transportation.