Frontline Medicine: Camp Bastion's battlefield hospital
I watched a young soldier lying in the mud under a sweltering Afghan sky as his friend, with fumbling hands, desperately tried to get a tourniquet round his naked leg.
The screaming was incessant until finally the tourniquet was in place and fiercely tightened.
What I was watching was a training exercise at Camp Bastion, with most of the screaming coming from instructor, Sergeant Lee Melvin.
His job is to prepare new troops in Afghanistan for what they may encounter out on the battlefield and he makes it as realistic as possible.
Soldiers are instructed on using a tourniquet
War has always driven innovation in medicine and science, and the reason I was out in Afghanistan was because we were filming the documentary Frontline Medicine, which I'm presenting for BBC Two, to find out what has been learnt from recent conflicts.
Jane Aldous, the series executive producer, has made numerous series with the military, including the Bafta-winning Wounded and The Bomb Squad - so I thought her excellent contacts would mean making this series would be straightforward - but I quickly learned it was far more complicated than I had realised.
There were issues to be ironed out about filming patients who were critically injured or unconscious and who weren't able to give informed consent.
An added complication was the fact that Camp Bastion Hospital, although run by the British, had medical staff and patients from a variety of other countries.
We were only allocated four seats, which meant the assistant producer, Blythe, also had to cover the job of a sound recordist.
Fortunately she's experienced, because trying to record decent sound in a busy battlefield hospital is a real challenge.
We were also fortunate to have cameraman, Andrew Thompson, who as well as a great sense of humour has plenty of experience of Afghanistan, having been out there filming with Ross Kemp.
The hospital we filmed in is in Camp Bastion, where they treat injured troops of all nationalities from all over southern Afghanistan.
They deal with some of the most extreme injuries you'll see anywhere.
Despite this they manage to save the lives of up to 90% of the wounded, the highest success rate in the history of warfare.
One reason for this is that they are incredibly well set up.
I was there for a couple of weeks and in that time watched dozens and dozens of badly wounded people (and a couple of bomb sniffer dogs) being treated.
Gunshot wounds, soldiers cut to pieces by shrapnel, burns and numerous amputations caused by improvised explosive devices (IEDs) were a regular occurrence.
Camp Bastion medics work on the US solider Chuck's injury
I saw a lot of badly injured people in Bastion, but only one that reduced me to tears.
He was a young US marine called Chuck who had had his left leg partially amputated by a bomb blast.
Although he had been treated on the helicopter, he was still in a lot of pain.
Chuck was fortunate because the anaesthetist at Bastion, Surgeon Commander Dan Connor is very skilful at pain management and he's particularly good at a technique which the military have been refining over recent years.
Instead of just giving morphine, Dan carefully inserted a fine catheter into the area near Chuck's popliteal nerve, the nerve that provides pain signals from the foot.
He then connected it to a pump that keeps a regular flow of local anesthetic to the nerve.
When I saw Chuck that evening he was completely pain free. With the apparatus in place he was flown back to the US for further surgery.
Continuous nerve blocks, like the one he had, are increasingly being used in the NHS for procedures like knee replacements.
Getting out of Afghanistan was harder than getting in. The RAF told us they could not guarantee our return date and I was a bit desperate.
Fortunately we found a plane flying to Dubai, which we boarded at dead of night.
My trip to Afghanistan was just the beginning of a long and fascinating journey to find out more about medical innovations that have emerged from recent military-funded research.
You'll see in episode two that we got access to a range of such research, including trials of new prosthetics and devices that allow blinded soldiers to "see" with their tongues.
The cost of this war, for civilians and military, has been exceptionally high.
But I do believe some good will come out of so much suffering and because of what we've learnt, future lives will be saved.
Frontline Medicine continues on BBC Two on Sunday, 27 November at 9pm.
For further programme times, please visit the upcoming episodes page.
Comments made by writers on the BBC TV blog are their own opinions and not necessarily those of the BBC.