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, popular for its 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 seeking to arrest alleged members of the Comando Vermelho gang they believed to be hiding in Vidigal, broadcaster TV Globo reported.

The main access route to the trail was blocked as the officers and suspected gang members exchanged fire, leaving the alarmed tourists stranded.

Video shared on social media shows the group sitting on the ground as the sun rises - a police helicopter flies overhead and shooting can be heard in the distance.

Portuguese tourist Matilda Oliveiro was waiting to see the sun rise from the top of Morro Dois Irmãos with her sister Rita when the guides told everyone to sit down.

We had waited for sunrise and, suddenly, the guides asked us to sit down and we started hearing gunshots, she told TV Globo.

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.

The stranded group were able to descend after about 30 minutes, according to local media.

The guides had been informed about the operation beforehand, according to Rita Oliveiro. Other local guides told TV Globo they had coordinated with police units operating in Vidigal.

We were caught by surprise. We were already at the top when we started hearing gunshots, and the guides were already telling us what was happening, Danielly Nobre, 25, told daily newspaper O Dia.

Nobre said the guides reassured her party that everything was under control. A passing police helicopter also signalled for calm, she added.

In the end, everything worked out. Everyone went down in a single file, everyone helping, and we managed to finish the trail, see the sunrise, and experience that adrenaline rush, Nobre told the paper.

Comando Vermelho and groups like it enforce strict rules in the areas they control. These criminal enterprises have moved beyond the sale of drugs and now hold the monopoly for the provision of gas, cable television, internet and transport.