For Lt Col Darrel Vandeveld, a devout Catholic, the twin responsibilities of religious faith and military duty led to a profound moral crisis.
In 2007, he became a prosecutor for the military commissions which tried terrorist suspects held at Guantanamo Bay, a role he took enthusiastically.
"I went down there on a mission and my mission was to convict as many of these detainees as possible and put them in prison for as long as I possibly could," he told the BBC.
"I had zero doubts. I was a true believer."
But his zeal did not last long.
When he arrived, he says he found the prosecutor's office in chaos, with boxes scattered around the floor, files disorganised, evidence scattered in different places and no clear chain of command.
And more seriously, he soon discovered that defence lawyers were not receiving information which could help clear their clients, including evidence that suspects had been "mistreated" in order to secure confessions.
A devout Catholic, Col Vandeveld found himself deeply troubled by what he discovered. But the classified nature of his work meant he was unable to share his growing doubts with friends and family.
A Jesuit priest tells how Darrel Vandeveld contacted him for advice before quitting. As a result, he took the unusual step of emailing a Jesuit priest called Father John Dear, who is a well known peace activist.
In his email, Col Vandeveld talked of having "grave misgivings".
Father Dear was initially unsure if the email was serious and fashioned a quick reply.
"I sort of didn't believe it. But on the off chance he was a military prosecutor I wrote back and said 'quit'."
Col Vandeveld says his jaw dropped when he read the email, adding: "I lived in dread of that answer."
But eventually he did resign and has chosen to speak out about what he saw, giving the BBC his first interview.