VILA BITTENCOURT, Brazil (Reuters) - In an isolated army outpost deep in the Amazon jungle, Felipe Castro leads 70 soldiers on the frontline of Brazil’s fight against its biggest security threat: the drug trade.

A Brazilian Army soldier patrols the border with Colombia during a training to show efforts to step up security along borders, in Vila Bittencourt, Amazon State, Brazil, January 18, 2017. Picture taken on January 18, 2017. REUTERS/Adriano Machado

Castro’s platoon patrols a 250 km (155 miles) stretch of the border with the world’s top cocaine producer Colombia in a bid to stem the flow of illegal drugs and arms that is fuelling a war between criminal gangs in Brazil.

“It’s a difficult job but not impossible,” said the gaunt 29-year-old, his face covered in green and black camouflage.

Watching from the bank of the murky Japura river, Castro directs his men as they use a metal speedboat to practise intercepting drug shipments on its fast-moving waters.

The river marks only part of Brazil’s porous border that stretches for nearly 10,000 kms, three times the U.S.-Mexico frontier.

After years of fragile truce, Brazil’s drug gangs have launched a battle for control of lucrative cross-border smuggling routes that has spilled into the country’s gang-controlled jails, sparking the bloodiest prison riots in decades.

More than 130 inmates have been killed so far this year.

In the vast state of Amazonas, the North Family gang has for years dominated the smuggling of cocaine that is shipped to Europe or sold in Brazil’s inner cities in a business believed to be worth $4.5 billion a year.

Brazil is the world’s biggest consumer of cocaine after the United States, according to United Nations data.

Slideshow ( 12 images )

Machete-wielding North Family gangs decapitated dozens of inmates of the rival First Capital Command (PCC) in a New Year’s prison massacre that has sparked revenge killings across penitentiaries in northern Brazil.

President Michel Temer’s government is worried the prison violence could spill onto the streets of major cities such as economic hub Sao Paulo and Rio de Janeiro, a major tourist destination.

Temer has vowed to improve military surveillance along the border, but senior commanders acknowledge drugs and arms will continue to flow in.

“Not even the United States has been able to stop drug trafficking along its border with Mexico,” said General Altair Polsin, head of the army’s ground operations command. “You have to tackle consumption to put an end to this.”

The military plans to increase its patrols on the Solimoes River, one of the main smuggling routes, and share intelligence with officials in neighboring Colombia and Peru.

Officers are putting their hopes in a technology upgrade to use infrared sensors and drones for border surveillance.

For this year, Brazil plans to nearly double its budget to about half a billion reais to finance a border technology program known as SISFRON, according to Defense Minister Raul Jungmann.

Updated technology is crucial for the 1,500 soldiers in the 24 garrisons posted along the Amazon border who divide their time searching for drugs with raids on illegal miners, loggers and hunters.

Other Brazilian security agencies fighting drugs and arms trafficking in this isolated swath of the jungle are also stretched.

Amazonas needs an extra 7,000 civil and military police to keep up with the increase in drug activity, according an internal report by the state security secretary.

“We are 30 officers overseeing an area the size of France,” said Marcos Vinicius Menezes, the federal police chief in Tabatinga, a city washed by the Solimoes that borders Colombia and Peru.

“If fighting the drug trade wasn’t enough, we also have to look after the world’s biggest tropical forest.”