Just days after Private Bowe Bergdahl went missing from his base in Afghanistan in 2009, the men in his platoon were ordered to sign papers vowing to never discuss what he did, or their efforts to track him down. Many of them were already exhausted, having searched endlessly in the hot dust and misery of the Afghan desert for a guy they knew had chosen to walk away. More than six months later, long after US Army officials had learned that Bergdahl's captors had smuggled him into Pakistan, commanders still had a sweeping gag order on thousands of troops in the battlefield. Some were told they could not fly home until they signed the non-disclosure agreements. And even now, six years later, as America's most notorious prisoner of war faces an August court-martial that could put him in prison for the rest of his life, the Army is still refusing to let the public see critical documents.

The Pentagon finished its formal investigation, known as an Army Regulation 15-6, more than a year ago. That report, led by a two-star general, includes interviews with more than 50 people, including Bergdahl. In 371 pages of sworn testimony, he told General Kenneth Dahl what he did, why and what he endured during his five years as a hostage. The 15-6 is not classified, and at a preliminary hearing, General Dahl testified that he does not oppose its release. But the Army won't budge. And in the absence of facts, ignorance and bloodlust reign. At Donald Trump rallies, crowds roar when he calls Bergdahl a "dirty rotten traitor" who should be shot. On social media, a vast chorus of US patriots and partisans join in. The longest-held American PoW since Vietnam deserves no mercy. And the US Army apparently agrees.

But despite the Army's campaign to hide the facts, the truth has slipped from its grasp. You don't need to read the 15-6 to know what Bergdahl did and why. The mystery is why the military, ignoring its own investigation as well as the unspeakable torture Bergdahl endured, seems determined to crucify him.

Motive was always the confounding question at the heart of the case, but Fox News claimed it had the answer when it aired a stunning report in early spring 2015. "There is clear evidence," said former Army intelligence officer Tony Shaffer, "that [Bergdahl] was going over to the other side." Citing senior government sources with access to a 2009 report by the Naval Criminal Investigative Service (NCIS), Bergdahl, Shaffer declared, "was actually trying to offer himself up to the Taliban".

This was big news; the cable juggernaut touted its scoop on its most popular shows, and it took root in social media, tarring Bergdahl as a traitor.

But there is a serious problem with that report: it doesn't exist. Shortly after the Fox story aired, the NCIS stated that no one at Fox had called to confirm what the report said or even to verify that it existed. Ed Buice, the NCIS public affairs officer, said: "There is no report." No matter. In the court of public opinion, Bergdahl never had a chance. In the absence of a plausible explanation for his disappearance, rumours swirled. Men from his company – Blackfoot – grumbled that he liked to spend too much time with the Afghans. He didn't drink or hang out. The soldiers didn't question their duty to rescue him, but they weren't happy about risking their lives to save this misfit.

Desperate to track him down, the Army solicited tips from Afghan sources – and when the reward for quality information climbed to $25,000, intelligence was soon swamped with reports. Mostly false leads and Taliban propaganda, they ranged from the treasonous (he was teaching the enemy bomb tactics) to silly (he had taken several wives and was living in a lavish hilltop villa). But, says a former Defense Department official, "We were chasing rumours." There were "no reliable reports that indicated he was a traitor". Still, shady intelligence was better than none; so rescue teams were told Bergdahl might not leave his captors peacefully and were instructed to use auto-injectors of Valium to quell him.

Bowe Bergdahl arriving at the pretrial hearing last month at Fort Bragg, North Carolina (Getty)

When soldiers desert their posts in war, they typically run from the fight, toward safety. Bergdahl did the opposite, walking directly into his own kidnapping. Over the course of his 1,797 days in chains, he was starved, beaten and under constant threat of execution. For more than three years, he lived in a 6ft by 6ft steel cage with no running water and severe chronic diarrhoea.

Several months before his release, as secret negotiations with American officials finally progressed, his captors tried to improve his appearance. They fattened him up and exercised him on a collapsible treadmill. And then, on the morning of 31 May 2014, they dressed him in a white shalwar kameez, drove him to the Afghanistan-Pakistan border and handed him over to a group of American agents. About 8,000 miles to the west, five Taliban detainees walked out of the Guantanamo Bay military prison and were flown to Qatar on an American cargo plane. The Taliban videoed all of this, from Bergdahl staggering to the Black Hawk helicopter to the group hug in Qatar, making the entire episode the most documented prisoner swap in American history.

Bergdahl was quickly taken to Germany, where he received medical care and was questioned. (He asked if he could have some peanut butter.) He was then transferred to Fort Sam Houston in San Antonio, where hostage experts, survival psychologists, FBI agents and intelligence officers interrogated him further. Meanwhile, General Dahl was appointed to lead the 15-6 and recruited a team: an infantry platoon leader, nine officers, 10 enlisted men, an intelligence analyst, a psychologist, a psychiatrist and a few financial experts. Over the next 59 days, they interviewed 57 people, including members of his platoon, his company and his family. And at a preliminary trial in September 2014, General Dahl would try to explain the seemingly inexplicable.

He described a 23-year-old with the delusional and sometimes grandiose perspective of a sheltered adolescent. He said Bergdahl's unique upbringing, eight miles along a dirt-road canyon, "on the edge of the grid, denied him, frankly, some normal social development opportunities". He testified that Bergdahl, who joined the Coast Guard in 2006, "looking for some adventure", only lasted three weeks before "he became overwhelmed and found himself in the hospital". The Coast Guard diagnosed him with "adjustment disorder with depression".

In 2008, with the war in Iraq pressuring military recruiters, 20 per cent of US enlistees that year entered the service under lowered standards. The Army issued Bergdahl a waiver for his illness, as it did for thousands of men with felony records. He joined the Airborne Infantry and sailed through basic training. But as the months progressed, so did his confusion.

When Bergdahl was shipped out to Afghanistan, he carried small notebooks with him and, in his downtime, filled them with meticulous, handwritten stories. According to Josh Cornelison, a medic in Bergdahl's platoon who found one after he left, he wrote about "a hero against the world, and Bowe Bergdahl was that hero". General Dahl also testified that Bergdahl "was very motivated to deploy": he wanted to do big things in Afghanistan, missions that a Navy Seal team might be assigned, but that he had no realistic hope of doing. He was frustrated that he wasn't kicking in doors and doing hand-to-hand combat.

This portrait of Bergdahl is less dramatic than the plotting traitor that cable news portrays, but it's close to the descriptions provided by those who knew him best. "My gut tells me he grossly underestimated what he was doing," another 2nd Platoon soldier says. "I don't think he intentionally sought out the Taliban. I think he left and [then] said: 'Oh shit, I made a monumental, horrible decision.' "

The preliminary hearing in September was Bergdahl's first public opportunity to explain why he made it. He said his plan was to hike about 18 miles to a nearby base, thereby triggering a missing soldier alert. After what he imagined would be his triumphant reappearance, he hoped to earn a private meeting with a general who would listen to his concerns about dire leadership and safety issues in his unit. That story suggests he was delusional. But while it is not a guilty plea to the charges he faces – "desertion with intent to shirk important or hazardous duty" and "misbehaviour before the enemy by endangering the safety of a command unit or place" – it is close.

The defence offered three main arguments in response. One: Bergdahl is guilty of going Awol, during which time he was kidnapped. He did not intend to leave permanently and is therefore not guilty of desertion. Two: the Army shares the blame for this tragedy. Bergdahl washed out of the Coast Guard with a mental breakdown, but they issued him a waiver and deployed him to a dangerous war zone. (In Afghanistan, his superiors ignored a concerned report about Bergdahl's mental state from a sergeant in his platoon.) Three: the many years he spent in brutal captivity should be a mitigating factor. The grim details, as well as his good conduct, make a prison sentence both redundant and inhumane.

One of Bergdahl's most grievous sins, in the eyes of many, was putting the lives of fellow soldiers at risk. The routines of the war they had been waging were instantly shattered by his disappearance. Relative calm was replaced by what his platoon's ranking officer, Captain John Billings, called "franticness", a virus of chaos that spread to Blackfoot Company at large, and eventually to all the forces in the region.

According to another Pentagon source, the crisis altered strategies at the highest level. Michael Waltz was a Special Forces major who took command of a team of Green Berets that day. "We unequivocally stop what we are doing, pivot and devote every asset we had to this search," he said.

After Billings reported his soldier Dust-Wun (duty status whereabouts unknown), he organised a hasty nine-man foot patrol. "Did taking out that patrol decrease your ability to defend Observation Post Mest?" the prosecution asked. "Absolutely," replied Billings.

But some veterans and their families want Bergdahl held accountable for more than just rushed foot patrols. Three chairs in that courtroom were reserved for the family of Second Lieutenant Darryn Andrews, who they say was killed on a search mission in September 2009. The inconvenient problem here is that the Army has never explained why any infantryman was searching for Bergdahl nearly two months after solid intelligence placed him in another country. But it turns out, according to several military sources, that the Army used the crisis to gain strategic advantages.

"It was common knowledge that commanders in the field used searching for Bergdahl as a justification for more aggressive tactics," the former Defense Department official says. A former officer who served in the region adds, "It was a good excuse. 'Bergdahl' became a language tactic to get assets." But regardless of these subterfuges, the former officer's sympathy lies not with Bergdahl but with the men sent to find him: "They all knew that Bergdahl was a shithead, but they still attacked every mission with absolute dedication."

Then there are Bergdahl's 1,797 days as a PoW. In the preliminary trial, the defence called Terrence Russell, the Pentagon's lead de-briefer, who has managed 125 such cases, including those of Jessica Lynch (captured in Iraq in 2003) and Bobby Hall (captured in North Korea in 1994). In his career, Russell said, he has met just one or two former hostages he did not believe were being honest. Bergdahl was not one of them. He added that Bergdahl rigorously catalogued his memories of captivity because "he knew he would be an important source of information for the intelligence community and for special operations forces".

No one will say whether the military applied that information, but there are some clues. In the five months prior to Bergdahl's release, the CIA drone strikes over Waziristan in north-western Pakistan were suspended. Ten days after he was recovered, the agency opened a sustained campaign in the tribal territories, and in the next two months took out compounds, vehicles and dozens of suspected militants.

President Barack Obama with his parents Jani and Bob Bergdahl (AFP/Getty)

But for those who call him a traitor, there is a more pressing question: what did he tell his captors? Russell had a simple, blunt rebuttal: "I would be shocked if Bergdahl had any classified information that he would have been privy to anyways … He didn't have any information to give." Russell also talked at length about the degradation Bergdahl suffered: how he was beaten with rubber hoses and copper cables; and how, after his first escape attempt, guards tied his hands and feet to a bed frame, and aside from one or two daily bathroom breaks, left him in that position for three months, "purposefully to atrophy his muscles".

Each time his captors moved him to a new location, Bergdahl tried to escape: climbing up to the window; trying to get out of the ceiling, to dig through the wall, to dig under the wall. "He's manipulating the locks on his restraints so that he can get out," Russell reported. "And he gets out, and tries to climb the wall."

In late 2011, at his sixth location, Bergdahl finally got free. "He successfully breaks his restraints. He gets out of his cell. He climbs down using a makeshift rope … and he starts running." He was gone eight and a half days, avoiding people, sticking to the woods. "To survive, he drinks what water he can find. To eat, he eats grass." When they find him, he is sick, weak and nearly naked.

This time, his captors built the cage, with no holes larger than what he could fit his hand through. Whenever they moved him, it was broken down and moved with him. "And that was his home for the next three, three and a half years." Russell praised Bergdahl as "an army of one", who took command of his hopeless battle without the psychological benefits of fellow prisoners. "He had to fight the enemy alone for four years and 11 months … You can't [overestimate] how difficult that is."

Today, as Bergdahl prepares for the court-martial, an information war is still being waged, with many pundits eager to convict him of even more heinous crimes. In the weeks following the September hearing, Fox News viewers were told that "seven of [Bergdahl's] platoon mates died searching for him"; that "this guy defected, he went over to the enemy, he gave them aid and comfort"; that the day before he left, "Bergdahl tells his platoon mates he wants to join the Taliban and voluntarily leaves his unit during combat … Afghans tell reporters that Bergdahl came through their villages looking for the Taliban. Bergdahl actually calls his unit and says he's not coming back."

Not one of those claims can be verified. But outrage trumps truth. On the witness stand, Russell said Bergdahl could not be accused of a "lack of resistance [or] willingness to serve his country". But a platoon mate of Bergdahl's is in two minds. "He was my friend, but at the same time I resent him," he says. "You don't do that to the guys."

He wants to see Bergdahl dishonourably discharged. But, like General Dahl, he doesn't believe he should go to jail for a lengthy sentence. "I think he was just a dude that made a really, really messed-up decision. He paid for it. He paid for it dearly."