You mistake incompetence with "willfull neglect" if not purposeful malice. The CIA had an asset named Ali Mohammed. Long story short, dude was a former Egyptian Colonel turned terrorist/CIA asset double agent. He was in the US military for a while, took leave to go wage jihad in South Asia, it gets brought up and shoved under the rug; on top of a myriad of other bullshit he did. He took classified data like the US's military manuals about tactics and shit and openly gave it to the terrorists. They knew he was dirty for years and let him do his shit unhindered; eventually taking action when it got too hot to ignore.
en.wikipedia.org