
RIO DE JANEIRO — The cop stood at the door of the police base beside a basketball court in Prazeres, an impoverished hillside neighborhood. As Saturday afternoon melted into night, music played quietly in the distance.
The court used to echo with the sound of samba school rehearsals and children’s games. It had been the cultural hub of the favela, as these improvised communities are called.
Now the basketball court was silent and dark. Nearby, a member of a drug-selling gang patrolled an alley with an automatic rifle. A week earlier, gun battles had raged between police and a drug-selling gang in Prazeres, leaving three men dead.
Just two months before Rio hosts the Olympics, a much-vaunted ‘‘pacification’’ program in the city’s favelas appears to be crumbling, and a wave of violent crime is causing anguish among city residents.
The number of murders in Rio state was up 15 percent in the first four months of 2016, compared with last year, although the figure dipped in May. Street robbery climbed 24 percent this year, according to statistics, which run through April. And last month, the gang rape of a 16-year-old girl in a Rio favela made headlines in Brazil and around the world.
Authorities insist that the Olympic Games will be safe for visitors, with 85,000 armed troops and police guarding Rio’s streets.
But even the Rio state security secretary, José Beltrame, acknowledged problems with the growth in crime, which he blamed on a severe recession and a financial crisis in the state government. ‘‘Without any doubt, the situation got worse in the last four months,’’ he said in an interview.
In 2008, a year before it clinched the Olympics, Rio state launched a “pacification’’ program in favelas dominated by violent drug gangs. Police bases were set up in metal shipping containers — 38 favelas have them. Under the plan, the state would provide community policing, and federal and municipal bodies would supply improved transportation, education, and other services.
But the Prazeres favela offers a glimpse of how the program has fallen short.
The neighborhood got its police base in 2011. Foreigners began flocking to monthly hip- hop parties here. The community sits just above Santa Teresa, a colorful colonial neighborhood that is a magnet for tourists because of its bars, hostels, and five-star hotel. Santa Teresa is within walking distance of the marina where Olympic sailing races will be staged.
But these days, the hip-hop parties in Prazeres are on hold. Two Spanish Olympic sailors and a coach were recently mugged at gunpoint on a Santa Teresa street. A bar and a pizzeria were held up by armed gangs. When a reporter visited another nearby favela, Fallet, he saw what appeared to be armed gang members guarding a street.
Police bases in favelas are increasingly coming under attack as the drug gangs get bolder.
‘‘In the beginning the community believed the [pacification] project was coming to benefit everyone,’’ said Eliza Brandão, 55, president of the Prazeres residents’ association. Residents hoped for better public services, but they never arrived, she said. ‘‘People lost confidence in the process,’’ she said.
Residents say that the rise in crime is linked to Brazil’s recession, its worst since the 1930s.
‘‘People are desperate. We have a failing economy, nothing for these communities, no opportunities,’’ said Theresa Williamson, founder of a nonprofit group called Catalytic Communities that works in favelas.
To compound the situation, Rio’s state government is broke and has slashed police budgets by a third. Beltrame said he had to cut overtime hours.
‘‘I have never faced a crisis like this,’’ said Beltrame, who has been in his job nine years.
Authorities nonetheless pledge that tourists will be safe during the Olympics, which begin Aug. 5.