SAO PAULO (Reuters) - More than two dozen heavily-armed men stormed into the center of Guararema early on a recent morning, rousing the Brazilian town’s residents with the sound of broken glass, explosions - and then gunshots.

A chart showing a rifle is seen in an office of the State Department of Criminal Investigations in Sao Paulo, Brazil February 8, 2019. REUTERS/Amanda Perobelli

Brandishing high-powered rifles, wearing bullet-proof vests and carrying several kilos of dynamite, the gang pulled up in front of the town’s main police station. It then set upon an adjoining branch of Banco do Brasil, shattering its windows and doors with crowbars.

In a coordinated 3 a.m. attack, police said, other gang members hit a Banco Santander Brasil branch two blocks away. They detonated the dynamite in an attempt to blow up ATM machines and vaults in both banks.

Such attacks have become commonplace in Brazil: Last year, an average of two banks or ATM machines were robbed every day, mainly in small towns without a major police presence.

The spoils can be substantial.

Each ATM has four boxes storing up to 2,700 bills apiece, meaning one cash machine stuffed with 100-real bills can yield up to 1 million reais ($263,000). Bank robbers skilled with dynamite - working quickly - will often blow up several ATMs at each bank or go directly for their vaults.

To combat the robberies, Brazil’s banks have invested in anti-theft technology, ranging from specialized ATMs to facial recognition cameras. When that fails or the costs become prohibitive, they have simply closed branches; as a result, some towns no longer have easy access to financial services in a country that already has a higher proportion of “unbanked” residents than either China or India.

The rash of bank robberies reflects just one way in which widespread violence is taking a toll on Latin America’s largest economy, pushing frustrated Brazilians to elect President Jair Bolsonaro in October on a promise to crack down on crime.

“Crime seeks opportunities,” said Rafael Alcadipani da Silveira, a public security expert at the Getulio Vargas Foundation, a think tank in Sao Paulo. “In Brazil, organized crime is very strong, security in small towns is weak and bank raids seem like an easy crime to commit.”

In the Guararema bank robbery, police pursued the gang to a nearby highway, where the two sides exchanged gunfire. Eleven gang members were killed by police.

Slideshow ( 7 images )

NOWHERE TO BANK

Brazil’s banks, which spend $2.3 billion on security each year, have made headway against the gangs.

Bank raids fell 20 percent last year, to 758 attacks, according to news reports and police records compiled by an association of private security workers, known as Contrasp.

The tally, which has declined steadily since 2014, does not capture the rising scale of heists like the one in Guararema.

Whereas criminals once knocked over individual ATMs in the street, banks have now moved their machines into bank branches where robbers often blow open a whole row at a time — which only shows up as a single attack.

The shift in tactics illustrates how criminal gangs are adjusting to added security measures by banks, warned Leandro Vilaim, business and operation director at bank industry association Febraban.

“There is no silver bullet,” he said. “These measures are short-lived because attacks are always changing in nature. When banks squeeze the bandits, they find a new way out.”

Cash machines sold in Brazil, at up to 150,000 reais each, cost roughly double those in the United States.

That reflects the price of tamper-resistant technologies including explosion-resistant safes, ink that stains bills when cash machines are dynamited and an average of 10 specialized sensors to respond to attacks — all of which drives up costs.

“Brazilian ATMs are so robust that if the country was bombed in a war, only cockroaches and ATMs would be left,” said Vilaim.

Other contermeasures include ear-piercing sirens, strobe lights and even fog machines traditionally used at night clubs, deployed to stun thieves. And Brazilian lender Itaú Unibanco Holding is investing in cameras that can identify thieves even when they use disguises.

Slideshow ( 7 images )

Then there is the ultimate deterrent: shuttering a town’s branch altogether – an increasingly frequent solution that is leaving a growing number of small Brazilian towns without a single bank or ATM.

Some 200 towns that had at least one branch as recently as 2016 now have none at all, according to the country’s central bank. That is sometimes the result of normal cost cutting, but in many cases a direct result of multiple robberies at the same branch, according to bank executives.

Closures have left some towns with no source of cash, prompting several local prosecutors to file suits against the banks, seeking to reopen the branches.

“The main complaint in those cities comes from merchants. People don’t have cash to buy stuff, so it affects the local economy,” said Glauber Tatagiba, state prosecutor in Minas Gerais, who has filed suits against lenders.

The southeastern Brazilian town of Minduri, for example, lost its sole branch, run by Banco do Brasil, in July, forcing its 4,000 residents to travel 22 kilometers (14 miles) to São Vicente de Minas to withdraw funds.

Months later, thieves blasted the ATM in São Vicente de Minas, so customers had to head 33 km in the other direction to the nearest bank in Cruzilia, whose own branch had only recently reopened after an explosion.

“It is tough situation especially for pensioners, who have to travel to withdraw money as few merchants take cards here,” said Minduri municipal administrator Lucas Magalhães.

ARMORED CARS AND RIFLES

What sets Brazil apart from other regions where ATMs are targeted, including parts of Europe and Africa, are the frequency of attacks, according to security experts, along with Brazilians’ explosive of choice.

In other parts of the world, explosive gas is usually used to blow up ATMs. But Brazil’s gangs have shown a taste for dynamite, usually stolen from mines and construction sites.

One dynamite stick strategically placed in a cash machine can send thousands of bank bills flying within seconds, ready to be bagged by waiting accomplices. Preparation, however, takes much longer, as the thieves carefully put together gangs of at least 10 people, each with their own skill set.

Gangs are equipped with high-powered military gear, often including tactical bulletproof vests, gloves, balaclavas, armored cars and .50 caliber rifles, said Pedro Ivo dos Santos, who heads the anti-bank robbery task force in São Paulo.

Even if the thieves’ equipment is second-hand or stolen, he added in an interview, the price tag for such an arsenal would run around 400,000 reais. Many police departments don’t have the resources to compete.

Once a gang targets an ATM, they assign specific jobs to perform during what typically amounts to a four-minute robbery. Some scatter metal road spikes to pierce the tires of police cars, for instance, while others specialize in opening the cash machines and inserting dynamite.

“ATM bombing is just the tip of the iceberg. Thieves usually start by robbing banks and later on use the proceeds to finance drug trafficking, in a move they see as career development,” said commissioner Santos.