Problem: I'm writing a sci-fi book that involves an adult character, who is a normal and innocent civilian (United States, year 2191), who got caught spying on a group of powerful terrorists running a stealth operation in the facility that he worked in. Instead of being killed, the character is taken in by the terrorists and forced to work for them as a sort of civilian operative, who could collect and feed them information or assist in other operations. The character isn't doing this willingly, but he is 'convinced' when the terrorists take his son hostage. Throughout the next eight years, the character (not by his own will) commits several crimes, not violent or murderous but many treasonous. He is soon caught by authorities in Houston, Texas. However, the terrorists in question are a lot more evil and malicious, and it's possible that during those 8 years, the character had commit a crime that assisted the terrorists in, say, a murder or robbery of protected information.
Question: Even though he was being forced to do so by terrorists, would the character be punished like any normal criminal committing these crimes? I need to know, because he agrees to help authorities put an end to the terrorist group. After they do, his son is released, and I want to implement an end to his character arc as a free, recovering man living with his son, unless his crimes call for imprisonment, of course. I'm very open to change this, if so.
Note: I don't know a lot about law. :p