Question: Was Bailey still insane when they released him from the asylum? Or was it all a trick to get their trust?
Question: Wouldn't going into the Iranian embassy and opening fire with guns be seen as a declaration of war? Especially since they shot/killed dozens of Iranian citizens while escaping.
Chosen answer: Perhaps, but against whom? The Americans, the Brits, the Koreans? And having an American citizen found tied to a chair, abused, and murdered would be hard to explain. In addition, their involvement in a narrowly averted nuclear holocaust may keep them from saying too much.
Chosen answer: Insane in the sense that he wasn't completely mentally capable? Yes. Insane in that he wanted to blow them up? No. He was heavily medicated while in care and so his ramblings and confusion are supposed to be perceived as genuine. Once he starts commenting that he is beginning to remember his past, we then assume that he realizes what his original intentions were and somehow manages to contact the other agency.
But Bailey states before he kills Katja that he was responsible for leaking the post online that Marvin saw which started the whole thing. He said he took a guard's phone to do it. I believe he was very aware and was just "playing" everyone.