Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A military judge sentenced Bowe Bergdahl on Friday to a dishonorable discharge and a reduction in rank but no confinement, which means no prison time for the 31-year-old soldier.

As a Republican nominee for president, Donald Trump repeatedly called Bergdahl a "traitor," suggesting that he be shot or thrown from a plane without a parachute.

Trump then appeared to incorporate those comments into his current policy at a news conference on Oct. 16, following Bergdahl's guilty plea for purposefully deserting his military post in Afghanistan in 2009. Trump referenced what he said about Bergdahl in the past, leading to the inference that his pre-White House comments still reflect his current position.

That same morning, Army Judge Col. Jeffrey Nance held that the president's tough remarks wouldn't prevent the soldier from receiving a fair sentence.

At the same time, the judge also indicated that he would consider Trump's words as part of his sentencing decision.

Nance's sentence is much more lenient compared to the 14 years in prison that prosecutors had wanted for Bergdahl. So did Trump's words lead to a lesser sentence?

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Related: No Prison Time, Dishonorable Discharge for Bergdahl

Probably, but we'll never really know for sure. That's just the nature of military sentencing.

Military courts-martial are similar to civilian courts in that either a panel (jury) or a military judge decides the outcome of the case. But unlike a civilian court (except in death penalty cases), whichever entity found guilt in a military court must also determine the defendant's punishment.

Bergdahl elected to be tried by a court-martial composed of a military judge alone — known as a "bench" trial in the civilian world.

Ordinarily, civilian bench trials are avoided by criminal defendants for a host of reasons. One is that a defendant's odds are better of convincing one of 12 jurors of reasonable doubt rather than trying to sway a single judge.

But Bergdahl's case is an exception to that traditional rule. For his actions, the Army sergeant was widely viewed as an outcast throughout the military chain of command, all the way up to the White House. After he left his post, Bergdahl was captured by the Taliban and held in captivity for five years before being released in 2014 in a prisoner swap.

A jury would likely have been influenced by passion and sentenced Bergdahl to a harsher punishment — one more in line with the prosecution's request.

During Bergdahl's sentencing, soldiers who went to look for him shared powerful testimony. In addition, the wife of a soldier who was shot in the head spoke about the pain endured.

Related: What to Know About Bergdahl, the Soldier Captured by the Taliban

A military judge, however, could better remain dispassionate to such testimony. The military judge option was Bergdahl's only hope — and the gambit paid off.

Sentencing procedures and decisions in this case were completely within the discretion of the military judge.

Except when a mandatory minimum sentence is prescribed by the code, Nance could adjudge any punishment he saw fit, including the maximum, a lesser one or none at all. So he was within his discretion in sentencing Bergdahl to no confinement.

In fact, with all of the concerns raised by the defense that Trump's comments exerted "unlawful command influence" over the court-martial, the pressure on Nance to be immune and impartial likely resulted in a subtle gravitational pull to leniency.

Danny Cevallos is a legal analyst for MSNBC.