FORT BRAGG, N.C. (Reuters) - U.S. Army Sergeant Bowe Bergdahl took the stand at his sentencing on Monday, apologizing to the troops who got hurt searching for him after he deserted in Afghanistan in 2009 and detailing the harsh conditions of Taliban captivity.

“I made a horrible mistake,” the 31-year-old soldier said during his most extensive comments to date at North Carolina’s Fort Bragg. “Saying I’m sorry is not enough.”

His statements marked the opening of the defense’s case, which suffered a blow earlier in the day when the presiding military judge said President Donald Trump had not damaged Bergdahl’s chances of a fair sentence.

Trump called Bergdahl “a no-good traitor” who should be executed during last year’s presidential campaign, and the defense said more recent remarks by the Republican showed his opinion had not changed.

Army Colonel Jeffery Nance said Trump’s comments during the campaign were “condemning and damning of the accused” but had not influenced the proceedings.

“I am completely unaffected by any comments President Trump has made about Sergeant Bergdahl,” Nance said.

The judge said he would consider the president’s comments as a mitigating factor, however, raising the possibility of a lighter punishment for Bergdahl.

Slideshow ( 5 images )

He faces up to life in prison after pleading guilty on Oct. 16 to desertion and misbehavior before the enemy. The Idaho native was captured by the Taliban after walking off his combat outpost in Paktika Province in June 2009 and spent the next five years in captivity suffering torture, abuse and neglect.

He was released in a 2014 Taliban prisoner swap brokered by the Democratic administration of former President Barack Obama.

Bergdahl testified that his captors locked him in “the cage” after a brief escape. He got little food, water or sleep and was forced to watch beheading videos.

“Years of nothing but waiting to see if the next person to come in through the door would be the person to execute you,” he said.

Bergdahl said he knew his words would not take away the pain of those injured looking for him.

Master Sergeant Mark Allen, the most critically hurt, suffered a debilitating brain injury that left him unable to speak or walk after being shot in the head during a July 2009 mission.

His wife, Shannon Allen, was the final prosecution witness on Monday.

“Instead of being his wife, I’m his caregiver,” she said. “Which doesn’t mean I love him any less, but it’s a very different dynamic. We can’t even hold hands anymore without me prying open his hand and putting mine in.”