Is it because he converted to Islam? That covers 1.25 billion people. In fact, the fact he did army service (yes I know there was the Fort Hood shooter, but for the most part people who do voluntary military service aren't your best bet for finding a terrorist, least of all one to bomb Spain of all places...), he had no valid passport (travelling under a fake ID In the western world is far harder than other places), etcetera. They ignored anything that would push them in the direction of "Oh he's not a terrorist". That's not very good, and that's horrifying as that could literally happen to any of us by nothing more than some bad luck.
And yeah, I agree with you on the spycraft thing. Those agents should be removed from field work if they're that terrible :/