SAO PAULO — More than 3,500 Brazilian soldiers are occupying a series of slum communities in northern Rio de Janeiro as part of efforts to combat a spike in violence.

The troops moved into the Complexo do Lins communities and neighboring Camarista Meier in the early hours of Saturday. Defense Minister Raul Jungmann told Globo TV that the troops would stay there as long as necessary.

Last week 8,500 soldiers were deployed in Rio to fight organized crime gangs, which control many of the city’s slums.

Brazilian television showed soldiers armed with automatic rifles sitting atop tanks as they patrolled the communities.

Mounting violence in Rio has led authorities to acknowledge in recent weeks that much of the city is out of their control.