A coroner broke down in tears at the inquest of a special forces soldier who he said "died with a rifle in his hand doing a job that he loved and protecting freedom".
Captain Richard Holloway, 29, was killed during a daring night-time raid on a Taliban stronghold outside Kabul, Afghanistan, on December 23 last year.
An enemy fighter, hiding in boulders up to 100ft high, sprayed a magazine from his Kalashnikov and hit the Special Boat Service (SBS) soldier in the thigh and pelvis.
His commanding officer, who was referred to during the inquest in Crook, County Durham, as Officer C and who gave evidence from behind a screen, carried him off the mountain side as bullets continued to fly, but said he knew he was already dead.
The coroner for Durham, Andrew Tweddle, wept as he spoke to Captain Holloway's parents Neil and Jaquie, and related their loss to that of his own.
His own son Aidan died aged 21 in a car crash in 2007.
Officer C had told the inquest: "Rich died with a rifle in his hand, he died doing the job that he absolutely loved and he died protecting the freedoms the Afghan people enjoyed, like the people in the UK."
At the conclusion of the inquest, Mr Tweddle's emotions broke through as he repeated those words.
He said: "He died with a rifle in his hand, doing a job he loved and protecting freedom. I have difficulty saying this.
"My son died some years ago in a car crash. If someone had said to me what that officer had said, I would feel very proud."
Mr Tweddle concluded that Capt Holloway, who was a Royal Engineer prior to joining the Special Forces, died from gunshot wounds sustained while on active operational duty in Afghanistan.
Capt Holloway's family, from Hamsterley, County Durham, were also in tears at the conclusion of the hearing.
At the start of the inquest Mr Tweddle said the Ministry of Defence had made an application to him for Officer C's evidence to be made from behind a screen so he could not be identified, having regard to "the operational effectiveness of the UK Special Forces".
It has been previously reported that Capt Holloway was a member of the SBS.
Officer C was in charge of a major operation to take out high-ranking Taliban officials living in what they believed was relative safety up a rocky valley outside Kabul.
He told the inquest: "Right when we started training for this specific role, I sat the whole group of my men down and said statistically one will be killed and four will be injured on this operation.
"This is nothing out of the ordinary. It happens, unfortunately. It is part of the risk of taking the job."
The officer said his men were not risk averse, "but we are risk aware".
At the time Afghan elections were looming and terrorists wanted to destablise the country with attacks on Kabul and other areas, Officer C said.
The aim was to attack the Taliban in a valley where no Allied forces had been for some time, and take them on in a place where they recuperated, trained and planned attacks.
Alongside Afghan forces, the Allied men were helicoptered in darkness to an area away from the valley, taking another three hours to cover the remaining distance on foot.
It started quietly as the forces made their way through compounds, looking for their targets.
Sporadic fire came from enemy positions above, but the operation had air support and the soldiers on the ground were not too troubled, Officer C said.
The group split in two and Officer C led one half and Capt Holloway led the UK soldiers in the other section, searching compounds for enemy commanders.
Officer C was diverted by a burst of gunfire which injured one of the team in the foot, but found the casualty was "in good spirits".
By now, fire from air support had killed "two or three Taliban", the officer said.
Capt Holloway was with a group checking another compound higher up, which had come under heavy fire from the air.
It was surrounded by huge boulders, with many "nooks and crannies where people can hide", the officer said.
"We had multiple air engagements on this position, we thought most of the enemy were dead.
"We approached with extreme caution but unfortunately one of the enemy had not been killed. He managed to get a burst off with an AK-47. Two members of the patrol were wounded and a military working dog."
There followed some moments of confusion as the men tried to locate the enemy, and more firepower from the air was brought in, Officer C said.
He tried to speak to Capt Holloway over the radio from his position some distance away and became concerned when he could not.
Officer C climbed up the hillside to Capt Holloway's position. "There were still some rounds coming off," he said. "I found Richard, put him on my shoulder and took him down the mountain."
He checked Capt Holloway's pulse and realised he was dead and took him to a casualty pick-up point.
Officer C said more air support was called in, resulting in another four opponents being killed, several of whom were "foreign fighters".
The operation was a tactical success, he said, as it disrupted the Taliban psychologically in an area where they would assume they were safe, particularly if they were in bed at 1am, he said.
"At an operational level, we went into a valley no one had been in for a long period of time, an area where the enemy felt safe."
The Afghan National Army carried out a successful sweep of the valley the next day.
Analysis showed 10 enemy fighters were killed, including one would-be suicide bomber.
An important part of the mission was to check on areas hit by Allied air attacks and to verify who had been killed so the Taliban could not later claim the vicitms were civilians and make propaganda.
"It stopped or definitely delayed multiple high-profile attacks into Kabul," he said, adding that the mission bought "space and time" to allow the democratic process to develop in Afghanistan.
"It is breaking the will and the cohesion of the enemy to operate," he said.
Mr Tweddle said it was hard for people to envisage the pressure and the terrain the forces operated in, from thousands of miles away. Officer C replied: "We train for this job and, arguably, we enjoy doing this job."
The other casualty who was shot at the same time as Capt Holloway was hit four times in the leg but has "almost made a full recovery", the inquest heard.
While in other missions, men had been fortunate with near-misses, Capt Holloway had been unlucky, he said.
Mr Tweddle said there was still considerable fire coming in when Officer C carried Capt Holloway down the mountain. "Absolutely," he replied. "(But) I was surrounded by pretty good guys and we did have air support. As I say, it's what we do."