In the midst of political volatility, a deep recession and a frightening viral outbreak, Brazil is struggling to woo visitors to the 2016 Summer Olympics with less than three months to go before the opening ceremony in Rio de Janeiro. With fewer than half of the tickets sold, the government is considering buying and giving away tickets to local schools.

But local security specialists and activists say crime should not be added to the list of reasons to stay home. Despite Brazil’s reputation as one of the world’s most murderous countries, visitors are statistically very likely to be safe.

Instead, Olympics security planners are wedging the 1.4 million residents of Rio’s surrounding favelas, or shantytowns, between two grim forces. In the runup to the Olympics, police have been cracking down on criminal activity, with an attendant increase in police brutality. And during the Olympics, security in poor, outlying communities will decline as police are redeployed to guard the foreigners traveling the corridors connecting the airport to hotels and event locations.

“If you are young, unemployed male and black, and if you come from a low-income area or a favela, the Olympics are going to be very bad news for you,” Robert Muggah, head of research at a Rio-based security think tank, the Igarapé Institute, said by phone. “If you are white, middle class or wealthy, and you’re a foreigner, you’re probably going be as safe as you are in a Northeastern city in the United States.”

Brazil has invested $11 billion in the Summer Games, and amid its numerous problems it has a strong incentive to ensure the events go on safely, even at the expense of security for its own people.

Rio Olympics Crime Brazilian Olympic badminton players Luana Vicente, 22, (left) and her sister Lohaynny, 20, use their mobile phones on the roof of a house in Rio's Chacrinha favela, May 4, 2016. Their father, a drug dealer, was killed in a shootout with police when they were four and six years old. Police killings of civilians in Rio's shantytowns have increased in recent years, but their absence during the Olympics as security forces guard foreigners could allow more street crime in poorer parts of this city of more than six million people. Photo: REUTERS/Nacho Doce Muggah says notorious incidents that get amplified in the media can create a gap between real and perceived risk. The high-profile killing of a 17-year-old girl in Rio on Saturday led Brazilian soccer star Rivaldo to post an ominous message on his 407,000-follower Instagram account warning foreigners not to come to the Olympics.

"Things are getting uglier here every day," Rivaldo wrote. "I advise everyone with plans to visit Brazil for the Olympics in Rio — to stay home."

Much as Brazil dealt successfully with protecting visitors during the 2014 FIFA World Cup, the government will redeploy police and military from throughout Rio state to guard the tourists. Muggah estimates that more than 80,000 security personnel, including at least 30,000 members of the army and reserves, will be deployed to guard the tourists, media and athletes, making parts of Rio, population 6.3 million, one of the most protected parts of the vast country during the 17-day event that starts Aug. 5.

Theresa Williamson, city planner and director of the Rio-based nonprofit Catalytic Communities, says concern over danger to tourists is stealing thunder that could be used to underscore the crime that is far more likely to affect locals.

“During the Olympics tourists will be incredibly safe; that is not a concern,” she said by phone, adding in a follow-up email: “Unfortunately the focus on a lot of these issues that the international press has come up with — 'is it safe for tourists/visitors? — is moot. We should be taking the visibility that's being generated and turning it around and pressuring the authorities to make the city safe and healthy for its residents.”