History question

  Why wasn't the U.S. and its vastly superior intelligence and military able to stop these attacks? How effective are current measures in dealing with attack prevention? Have we really learned from past mistakes?