Along with the tourists and the legions of athletes from around the globe, something else arrived in Brazil ahead of the Summer Olympics.
Until recently, the thought that Brazil could be a target for a terrorist attack seemed far-fetched. When the minister of justice announced the arrest of 10 Islamic State sympathizers last month, he suggested that even the suspects considered Brazil off-limits for terrorism.
"In their communications they always said that Brazil was not part of the coalition opposing Islamic State, so no action here could be justified," Minister Alexandre de Moraes said.
"At a certain point they decided that the arrival of foreigners could make Brazil a legitimate target."
The Olympics had finally dragged the country into the post-Sept. 11 era.
Local are still far more concerned with the festering, day-to-day criminal violence than any ideologically driven terrorism.
But the risks and exposure of the Olympics led the government to finally tighten the reins. Chatter between suspected terrorist sympathizers is now being monitored, security at airports — once so loose passengers could board planes without identification -- has been tightened, and Rio's tourist areas have been flooded with heavily armed police officers and soldiers.
"The Olympics brings risks of terrorism that weren't in Brazil beforehand because of the event's huge media saturation and opportunity for assaults on soft targets such as athletes and tourists," said John Friedlander, senior director at the Kroll security firm in New York, which analyzed risks for the Rio Games.
The risk of a terrorist attack in Rio de Janeiro is moderate, he said, roughly the same as if the Games were in Los Angeles. Saturating areas of the city with police and soldiers — as Rio has done — is a good start to minimizing the risk, Friedlander said.
Brazil is the world's fifth most populous country and has a deeply rooted crime problem. Violent death is not uncommon. But Brazil also has a neutral foreign policy, virtually no international enemies, and little recent history of religious strife. The last attacks here that might be considered terrorism were probably during World War II.
Even when Brazil hosted the 2014 World Cup, far less attention was given to potential terrorism than now. But a wave of attacks around the world since then, and the concentration of foreigners in one place for Rio 2016, led to deeper concerns.
"We already have terror in our daily lives. Terror of crime, robberies, murder. But religious terror? No, I don't think there's any risk of that here, at least not yet," said Clelia Lopes, a 72-year-old retired nurse who was waiting for her bus in Copacabana on Friday afternoon, just moments after a caravan of heavily armed military police followed the Olympic torch through the neighborhood.
"I don't think the people the government arrested were actually a real threat," she added. "But it's good we have this extra security during the Games."
Brazilian authorities say they have closely monitored communications within the country and act upon even the slightest hint of an attack. And Rio 2016 officials say that they are highly confident in security preparations, which include 88,000 security agents and intelligence collaborations involving more than 100 countries, including the United States.
"I can say, with complete conviction, that we couldn't be better prepared," Defense Minister Raul Jungmann told the Los Angeles Times. Jungmann took over the ministry when the elected president, Dilma Rousseff, was removed pending an impeachment trial.
But experts note that much of Brazil's border is porous and that even the best intelligence often falls short in identifying so-called lone-wolf attackers. Jihadist material distributed outside Brazil exhorts followers to carry out attacks during the Games, experts said.
One channel on the encrypted messaging app Telegram, titled "Inspire the Believers!" asserted that "visa and tickets and travel to Brazil will be very easy to get," telling followers that their "chance to take part in the global Jihad is here!"
Messages provided suggestions on how attackers "can take part in the Olympics too," including attaching knives to the propellers of popular drones or kidnapping athletes to secure the release of Muslim prisoners worldwide.
"American/UK/French/Israeli Athletes and visitors can be easily targeted during the entire Olympics!" one message read, warning would-be attackers to avoid targeting women, children and people from countries that are not at war with the militants.
But not everybody is rattled by the stepped-up security and hyper-awareness of possible terrorist attacks.
"I'm not so worried about terrorism or any kind of specific attacks on civilians, because we're a welcoming country, and we have these guys," said Carlos Alexandre Silva de Morais, a doorman and security guard, pointing to two military officers wielding large rifles on the corner outside.
"To be honest, I'm more afraid for when they all leave."
Bevins is a special correspondent. Special correspondent Nabih Bulos in Beirut contributed to this report.