James Bond is total fiction. Please trust me when I say that real spies don't carry weapons, they especially don't use them offensively. They are discreet, quiet, gather information, and pass it off to handlers via drops and such. Most importantly, real spies are recruited from within a population or work force. A Pakistani national could get around much better than an American.
I don't know what this guys was up to. I do know it's a no-win situation, though, for him, and the two countries. If released, riots will happen. If prosecuted, there will be pressure to cease $$ to Pakistan, and the more important goal, that of combatting terrorist goons, will be sidetracked.
The only winner is Taliban/TTP.