Twelve men were arrested during a major anti-terror operation which was sparked by a top police officer's embarrassing security blunder.