For years, the story told about the Amazon has been one of destruction - the world's largest rainforest, a region of amazing biodiversity, key to the fight against climate change, being remorselessly felled. But that is no longer the whole truth.

The Environment Agency special ops team gathered in a sultry town right on the southern edge of the Amazon. A group of officers, men and women, were relaxing in the shade of a majestic mango tree outside their offices. They were smoking and chatting.

These aren't bureaucrats with crumpled suits and clipboards. In Brazil, environment agents wear military fatigues, with heavy black pistols slung casually on their thighs.

These officers are, as I was to discover, soldiers on the front line in what Brazil regards as a war - a war to protect the Amazon rainforest.

I'd been invited along on one of the agency's routine raids in the jungle. The idea was to target a gang of illegal loggers the satellite monitoring team had spotted working in the forest.

On a map pinned to the wall, three commanders were working out strategies and logistics, just like a military operation. I was starting to feel distinctly anxious.

"Are the loggers likely to be armed?" I asked.

"Don't worry about guns," said the lead officer, Evandro Selva. "They're only likely to have hunting rifles. Nothing serious."

Nothing serious?

Media playback is unsupported on your device Media caption John Carter of NGO Alianca da Terra explains how the Xavante people are being trained to fight fires in their ancestral land

Moments later, we were in a pickup truck on our way to the airstrip and before I knew it, Evandro was urging me into the helicopter, its blades already scything through the humid air.

I just had time to strap myself in before he gestured for take-off and the ground shrank away. The pilot banked the craft round and off we thudded towards our target.

I was in Brazil to report on that rare thing, an environmental battle that is actually being won. For decades, pretty much the only story we've heard from the Amazon is about the remorseless tide of destruction sweeping through the forest.

Media playback is unsupported on your device Media caption River turtles hatch and then head off to 'nursery'

The received wisdom has always been that it is unstoppable. It is certainly true that the economic logic of deforestation is powerful - land in the Amazon is worth far more if the trees are cut down. But I was here to discover the remarkable progress Brazil has made in silencing the chainsaws.

My journey was to take me across the southern Amazon, the area the Brazilians call "the arc of destruction" - a grey area between civilisation and one of the world's last true wildernesses.

For years it was a vision of hell here. Vast fires swept through the forest while the chainsaws whined, and armoured tractors roared as they grubbed up the roots of the great Amazonian trees.

We could see the fruits of all this labour from the window of the helicopter. We flew over vast open fields, some many kilometres square that have been carved out of the virgin forest just in the last decade or so.

An hour into our flight, Evandro signalled that we were nearing the target. We were over what looked to me like pristine jungle when suddenly the carpet of trees gave way and a vast clearing opened up beneath us.

Swimming with a cayman I am still amazed that John Carter, an ex-US special forces soldier turned sustainability campaigner, persuaded me to swim with the 6ft (2m) cayman in the river by his Amazonian ranch. It was only once we were actually in the water that I thought to ask what to do if the beast dived. "Get out quick," John said without hesitation. "That means it is about to attack." "I thought you told me it wouldn't attack us!" I said. "I said I didn't think it would," he corrected me. "It's taken six of my dogs."

Even I could tell they had been freshly cut. There were still some trees standing - tall fragile-looking Brazil nut trees - but on the ground were great rough mounds of branches and brush. I could see open scars in the red earth where the machines had gouged their passage.

Over the headphones I could hear excited shouting in Portuguese. One of the officers pointed down. I saw a truck piled high with tree trunks and a tractor in front of it. Beside it were two, possibly three men, looking up at the helicopter.

We wheeled around and pilot started to bring the helicopter down. It kicked up a storm of dust and dry leaves. The rotors seemed perilously close to the trees. I hung on tight.

Then we were on the ground and running. The truck and tractor were still there but, of course, the culprits had fled.

"They'll be back," Evandro said confidently. "We'll just hide here and wait for them."

The three officers hid among the logs and branches, pistols in their hands. Cameraman Keith Morris and I also took cover. Meanwhile, the helicopter flew off in another flurry of leaves and red earth.

Then all was silent. Just the five of us crouching silently in the hot sun, clouds of tiny bees swarming around our faces and hands.

How can this possibly stop the onslaught, I thought to myself.

In the decade between 1996 and 2005, 19,500 sq km (7,530 sq miles) of jungle was lost on average every single year. The comparison is overused, but that really is an area about the size of Wales or New Jersey each year. It reached a peak in 2004 when more than 27,000 sq km was lost.

Then, in 2004 Brazil declared war - it said it would cut deforestation by 80% by 2020.

Media playback is unsupported on your device Media caption Why are ecologists setting fire to the Amazon?

Seven years later and it has almost reached its goal. The latest figures, released just weeks ago, show that 2011 had the lowest rates of deforestation since records began three decades ago - just over 6,200 sq km was cut. That's 78% down on 2004, still a lot of trees - an area the about the size of Devon, or Delaware - but a huge improvement.

Of course, the Brazilian government cannot claim all the credit. On my journey across the arc of destruction I met a bizarre cast of characters all of whom are playing a role:

John Carter, a Texan cayman-wrestling ex-US Special Forces soldier turned Amazonian rancher whose alliance of farmers and ranchers is working to improve land management on farms in the Amazon

The indigenous Amazonian Indians who have been recruited as "smoke jumpers" - forest fire-fighters

One of the most efficient agricultural enterprises on the planet - an Amazonian soya farm - by the multibillionaire they call the "King of Soya", who now claims to be an environmentalist

Greenpeace's swashbuckling pilot, Fernando Galvao Bezerra, a veteran of many of Greenpeace's successful campaigns, who earned his pilot's wings ferrying miners, prostitutes and priests into some of the most remote and dangerous places in the jungle

In one of the most remote states in the entire Amazon, a condom factory in the jungle makes the world's first rainforest-friendly rubbers using latex harvested from wild rubber trees in the jungle

But for the moment I was still hunched in the bushes, the first twinges of cramp in my leg and a river of sweat running down my back. We had been waiting half an hour when - just like in the movies - I heard a branch snap underfoot and suddenly the officers were up and running.

Hope

"Para ai! Para ai!" they shouted - "Stop right there!"

Image caption The agents seemed content with their haul

I saw a man in a ragged T-shirt dive into the dirt, arms wide as if he had been crucified. Another hesitated on the edge of the forest. The officer in front of me fired his gun. The man turned and darted off into the trees.

In all, the officers arrested five men and impounded three trucks and two tractors. I'd been nervous about confronting these guys but they seemed rather pathetic, smoking rollups in their scruffy clothes. The agents, however, seemed very content with their haul.

We hitched a lift back to the helicopter sitting on top of a pile of huge tree trunks on the back of a truck the enforcement officers had seized from the loggers. As we bounced back through the jungle, I couldn't help feeling a great sense of hope.

Find out more Crossing Continents is broadcast on BBC Radio 4 on Thursday, 5 January at 11:00 GMT and on Monday, 9 January at 20:30 GMT

You can listen again using the link below Listen again or download the podcast

Of course, the fact that there is still an illegal logging operation like this just an hour's helicopter ride from a major Brazilian city shows that there is still huge pressure on the forest. But extraordinary as it sounds, it really does seem as if the war to stop the destruction of Amazon rainforest is being won.

What's more this is happening before it is too late, because what most people don't realise is just how much of the forest is still standing. Satellite images confirm almost 80% of the Amazon is still intact.

What an inspiring thought to begin the New Year, I thought, as the battered old truck coughed and wheezed its way along the dusty path between the towering trees.

Crossing Continents is on BBC Radio 4 on Thursday, 5 January at 11:00 GMT and on Monday, 9 January at 20:30 GMT. Listen again via the BBC iPlayer or by downloading the podcast.