Last week's Paris killings have raised fears about the 2016 Olympic Games in Brazil, a country with so little history of terrorism that the president has played down the chance of an attack and legislators long resisted bills to make it a crime.
Diplomats in Brasilia say Western governments are worried about the safety of their athletes and tourists at the games because they believe many Brazilian authorities are complacent, taking too much comfort in Brazil's historical standing as a non-aligned, multi-cultural nation which is free of enemies.
President Dilma Rousseff last week brushed off the possibility of an incident in Brazil like the Islamic State attack in the French capital.
"We are very far away," she said after a summit in Turkey.
Security experts say many Brazilian officials do not realize just how big a stage the Olympics is for anyone seeking to sow terror, either through an attack on game venues, infrastructure nearby or the athletes and 500,000 tourists expected to attend.
"Brazil is way behind in preventing terrorism," says Fernando Brancoli, a researcher on the Middle East and security at the Getulio Vargas Foundation, a think tank and business school in Rio de Janeiro, the host city.
But Brazilian officials, eager to pull off South America's first Olympics, say they will ensure a safe games, which start August 5. They argue that Brazil is used to hosting major festivities, like the huge annual Carnival celebrations in Rio and elsewhere.
"We have safely hosted other big events," said General Luiz Felipe Linhares, the Army official in charge of preparations. "The Olympic Games, a bigger affair, will be equally successful."
Organizers are using past Olympics as models, cooperating with foreign intelligence services and building upon a successful safety record last year, when Brazil hosted the soccer World Cup. Compared with the last summer games, in London in 2012, they are doubling security personnel to 85,000 people.
The government's point man on security for the Olympics, Ministry of Justice secretary Andrei Rodrigues, traveled to Washington this week to deepen cooperation with the Department of Homeland Security and other U.S. agencies, aides said.
The U.S. government has invited Brazilian security officials to learn about security at mega events like the Super Bowl and briefing them on crisis management at attacks like the Boston Marathon bombing.
A U.S. Embassy spokesperson said the United States and Brazil have been working together in areas such as airport screening procedures and traffic into and out of stadiums.
Impossible to Control
For all its verdant beauty, Rio has many everyday security risks.
It is a chaotic sprawl where drug traffickers and armed gangs control slums. Police, if present, are often outnumbered and outgunned. Many of the slums abut Olympic venues, popular beaches and top hotels.
A European diplomat who deals with security issues and spoke on condition of anonymity said preparations for the Games are being hampered by a lack of coordination and outright turf wars between the police, the military and the national intelligence agency, ABIN. Other foreign officials also reflected those concerns but Brazilian officials dismiss them.
Brazil's federal police, a widely respected force that includes a professional counter-terrorism unit, has been lauded by many foreign governments for improving immigration controls in recent years and being more aggressive against international fugitives.
Even so, Brazil's thousands of miles of borders, much of which cut through dense Amazon jungle, are nearly impossible to control. And Brazil's Congress last month passed a bill allowing the government to exempt citizens of some nations from visas to attend the Games.
The chief of staff of the armed forces criticized the bill as making Brazil more vulnerable. But Tourism Minister Henrique Alves says the waiver would only apply to citizens of nations that have hosted the Games and are not seen as presenting a security or immigration risk, including the United States, Canada, Australia and Japan.
Brazil is about do away with a longstanding hurdle to fuller security ties with the United States by moving to make terrorism a crime punishable with up to 24 years in prison.
Until recently, the center-left parties in power had been reluctant to define terrorism as a crime because many senior politicians, including Rousseff, as a youth took part in guerrilla groups that were labeled as terrorists by the military dictatorship that ruled Brazil for two decades.
But now, they want to eliminate hurdles that would keep them from extraditing suspected terrorists or make Brazil a haven for criminals seeking refuge.
"The Paris attacks show that terrorism is an increasingly transnational crime," said Senator Aloysio Nunes, who recently pushed the terrorism bill, backed by Rousseff, through the chamber and is hoping for approval by the lower house.
"This law will provide tools to act against terrorism and cooperate with other countries fighting it," he added.