Of course you can't count on the courts to rule your way. That's the way that it was designed. Its supposed to be a check on the rest of government. The prosecuters simply failed to make their case and, they lost. They can whine all they want but, this is the way that the system is supposed to work.
The thought that we should avoid trying accused terrorists in court is absurd. The prosecuters may not like that trials aren't going their way but deciding that instead of trying them that they will simply hold them without trial is absurd and wrong. If we wish to punish these people for their alleged actions then the justice system needs to make their case in a trial. If they fail to do so then the only right thing to do is to let them go