A former U.S. Navy SEAL cried Wednesday while testifying about his military dog who was shot in the head by enemy fighters in Afghanistan while he was on a mission to find Army Sgt. Bowe Bergdahl.

Bergdahl, who had walked away from his unit, was held captive by the Taliban for five years.

The wounded SEAL, retired Navy Senior Chief Petty Officer James Hatch, entered the courtroom for Bergdahl’s sentencing hearing with a limp and a service dog named Mina. Bergdahl pleaded guilty last week to desertion and endangering his comrades. He could face life in prison.

Hatch told the court at Fort Bragg, N.C., that when he was assigned to find Bergdahl he thought “someone is going to get killed trying to rescue him,” but pushed on because Bergdahl “was an American" and had a mom.

Hatch was largely stoic and spoke in measured tones -- except when he talked about the slain military dog.

"His name was Remco," Hatch said as his voice cracked, recalling the moments before the dog was blasted in the head and killed.

"Take your time," said the prosecutor, Army Maj. Justin Oshana.

ARMY SGT. BOWE BERGDAHL: WHO IS HE?

Remco was leading them through a field when the dog located two enemy fighters the team had seen at a distance. Hatch said the fighters sprayed AK-47 bullets at them, killing the dog. Hatch was hit in the leg.

"I screamed a lot. It hurt really bad...I thought I was dead," he said.

Hatch said his unit was rescued, but medics had to kill two Afghans before taking off in the helicopter. Remco was brought on board and staff tried to resuscitate him, but it failed -- the dog’s jaw was blown off.

Photos of Hatch’s injuries and a vest that Remco was wearing that medics had to cut off were shown in the courtroom.

Hatch said the dog helped protect his team by locating enemy fighters after the SEALs lost sight of them in a chaotic situation.

He added his team's helicopters came under fire as they landed in an area near the Pakistan border where they had information on Bergdahl's possible whereabouts. He said the mission was hastily planned, and their only objective was the Bergdahl search.

Hatch said he believes he would have died if a comrade hadn't quickly applied a tourniquet. Hatch has subsequently had 18 surgeries.

BERGDAHL PLEADS GUILTY IN DESERTION CASE

He now runs a nonprofit dedicated to the care and support of military and law enforcement dogs.

Another witness, Capt. John Billings, told the court Wednesday that Bergdahl was one of his soldiers and they decided to rescue him because they wanted “to bring Bowe home….we leave no man behind.”

Billings, a platoon leader, described difficult conditions while searching for Bergdahl, as his patrol developed dysentery while trudging about in 100-degree temperatures with little sleep or water.

As the hearing got underway, an Army judge also said he was still considering a motion by the defense to dismiss the case. The defense has argued that President Trump's comments about Bergdahl prevent Bergdahl from having a fair sentencing hearing.

The judge, Army Col. Jeffery Nance said Monday he would be fair and hasn't been influenced by Trump, but that he does have concerns that the president's comments are affecting public perceptions.

While campaigning for president, Trump repeatedly called Bergdahl a traitor and suggested he be shot or thrown from a plane without a parachute. Nance ruled in February those comments didn't constitute unlawful command influence, noting that Trump was a civilian candidate for president at the time. The defense argued that Trump revived his campaign comments the day of Bergdahl's plea hearing, by saying at a news conference that he thinks people are aware of what he said before.

BERGDAHL SENTENCING: TRUMP'S RECENT COMMENTS CONCERN JUDGE

Evan Buetow was the third witness called to the stand Wednesday. Buetow, a sergeant who was Bergdahl's team leader, also became emotional during his testimony.

When asked why he searched for Bergdahl, Buetow said: "Because my guy was gone."

During the search for Bergdahl, Buetow said he was sick, he didn't get much sleep, got dysentery and was always hungry.

According to Buetow, who said he didn't know Bergdahl personally but rather professionally, the former solider always followed orders, was great at physical training and his uniform was always proper. He added that Bergdahl always volunteered, even for things he didn't want to do.

Aviation Col. John White, who also testified, said that when his command post got a report about Bergdahl, he sent squads, picked up a tracking dog and went to where they thought the missing soldier might be to begin tracking him.

While normal flights are supposed to be only nine hours during sunlight, White said he had worked over 13 hours and had to get extensions to fly longer. During that month, extension requests increased tremendously.

White added that less than 10 aircraft were damaged during Bergdahl search-and-rescue missions.

Prosecutors made no deal to cap Bergdahl's punishment, so the judge has wide leeway to decide his sentence. Several more days of testimony are expected.

Bergdahl has said he was caged, kept in darkness and beaten, and that he tried to escape more than a dozen times before President Barack Obama brought Bergdahl home in 2014 in a swap for five Taliban prisoners at Guantanamo Bay.

Fox News’ Terace Garnier and The Associated Press contributed to this report.