With a week to go before the World Cup kicks off, Brazilian authorities are bracing for waves of public protests over the cost of staging the event.
Caught out by the scale of demonstrations which accompanied last year's Confederations Cup dress rehearsal event, authorities have made detailed plans to counter anything from street protests to full-blown terrorist attacks.
"We have defined 15 areas of intervention over the past year and a half and have drawn up protocols on how to respond in each case, based on repeated testing.
"We are ready," government state secretary for major events Andrei Rodrigues told AFP. "When it comes to security one can never let one's guard down."
Around 157,000 troops and police will be deployed across the 12 host venues for the Cup, running from June 12-July 13.
Some 20,000 private security agents will also be on hand in the stadiums -- some 1,800 per venue in an $860 million operation.
In addition, 120 police officers from 40 countries will collaborate with the Brazilian authorities as they jointly collate and assess intelligence.
- Small-scale demos -
Militant groups have called a series of demonstrations during the World Cup as they look to reignite the kind of social protests which drew more than a million people into the streets 12 months ago.
Those large-scale protests saw loud calls for more investment in public services, an end to rampant political corruption and for World Cup costs to be reined in.
This year, "we have the feeling that they (the protests) will be on a smaller scale," says Justice Minister Jose Eduardo Cardozo.
Military police, responsible for maintaining public order, have been preparing for the demonstrations. They have received training along the way from the US Federal Bureau of Investigation and French riot police.
The military police units have been kitted out with hi-tech uniforms making their members look like something out of "Robocop". In Rio, meanwhile, mounted police units have been stocking up on horseshoes.
President Dilma Rousseff promised in April that nobody would be allowed to get near the 32 World Cup teams.
But last week, striking teachers got near enough to the Brazilian team bus to plaster the vehicle with protest stickers and also briefly blocked their exit from the airport at Rio.
The government immediately decided to send in army reinforcements to protect training centers and hotels to escort teams as they arrive in Brazil.
- Terrorism deemed unlikely -
Authorities judge chances of a terrorist attack as low. But Brasilia has modified its prevention and combat rules of engagement just in case.
The army can call on chemical, radiological and nuclear attack response teams and also boasts a cyber-security center.
In the Amazonian city of Manaus, authorities are already operating on "major alert level" to ward off a potential terrorist threat with the United States, England and Italy all playing in the northern venue.
"The presence of these teams obliges us to redouble our attention" to potential security threats, says Dan Camara, deputy secretary of security for major events.
The army and federal police are monitoring airspace and Brazil's 16,000 km (10,000 miles) of borders with neighboring states.
- Slum strategy bolstered -
With drug traffickers trying in recent months to recover terrain lost in turf wars in Rio's sprawling slums, authorities have moved to reinforce a six-year-old policy of attempted police "pacification."
This year has seen several attacks on police posts with six officers killed in slums, known as favelas, where the pacification strategy has been introduced.
Some citizens in the slums have accused the police of brutality, as well as torture and murder.
In April, a young dancer was shot dead, allegedly by a policeman, in a slum just a short walk from Rio's main tourist drag of Copacabana beach. His death sparked violent unrest.
Many favelas are situated almost within a stone's throw of some of Rio's most well-heeled districts and main access roads.
With the World Cup on the immediate horizon, police have decided to bolster their patrols in the slums "occupied" by some 450 officers.
In the big Mare slum network near Rio's international airport some 2,700 troops have moved in and will stay there until July 31.
- Banned items -
There is a long list of items banned from stadiums during the event, including fireworks, musical instruments, large banners and electronic items including computers and even tablets.
Falling victim to the ban has been the "caixirola", a trumpet-like instrument which the government initially promoted as Brazil's answer to 2010's South African vuvuzela.
The item was rejected after disgruntled fans threw some onto the pitch during test games at some World Cup venues last year.