You could almost hear the relief in President Obama’s words as he thanked FBI veteran John Pistole for agreeing to take the job. If ever there is a thankless task, it is trying to straighten out the mess at the Transportation Security Administration, the most clueless of federal bureaucrats who are responsible for keeping the nation’s highways, railroads, buses, mass transit systems, pipelines, and airports safe.

Created in the wake of 9/11 and now with over 50,000 employees and a $7 billion budget, TSA has become the butt of late night talk show jokes, a string of critical Inspector General and GAO reports, and the target of public fury over its arrogant, hapless airport screening system.

The agency’s incompetence was most notably highlighted last December after Nigerian-born Umar Farouk Abdulmuttalab was able to board a Detroit-bound jet from Amsterdam and nearly blew up the plane with explosives famously hidden in his underwear. The Muslim fanatic was able to fly to the U.S. despite the fact that his well-connected father had warned an American embassy that his son had gone to Yemen for training with jihadis. Abdulmuttalab was able to board the plane despite having bought his round-trip ticket with cash and though he had no luggage – both ill omens that should have flagged him on any American carrier anywhere.

And what was the TSA’s response to the system’s nearly catastrophic screw up? Rather than focus energy and resources on discovering how the system had failed, it sent three of its agents to the homes of two travel industry bloggers who had dared publish changes in security regulations that the TSA had sent by e-mail to thousands of its employees and commercial-airline representatives. Armed with subpoenas and threats of dire legal action, the agency was launching an investigation into who had “leaked” the security changes to the bloggers.

Fortunately, cooler heads prevailed at the Department of Homeland Security, which has the misfortune of supervising the TSA. The investigation was squelched. But DHS’s chief, Janet Napolitano, was herself under fire for having proclaimed that the TSA’s security system had succeeded, whereas, she subsequently acknowledged, it had failed miserably.

After the near miss, the Associated Press reported that the TSA had nearly doubled its no-fly list —from about 3,400 to nearly 6,000 people. But other less encouraging news has not gotten the attention it deserves. In March, Congress Daily reported that the DHS disclosed at a Congressional hearing that it would need another two years to ensure that all cargo on passenger planes is screened for weapons of mass destruction before being flown into the U.S. Gale Rossides, the TSA’s acting director, told the House Homeland Security Appropriations Subcommittee that while the TSA would meet the August 2010 deadline for screening cargo aboard domestic flights inside the U.S., screening incoming planes from overseas would not be possible by the deadline.

This sorry history brings us to Faisal Shahzad, who was pulled off an Emirates flight to Dubai moments before take off. DHS assures us that the name of the Pakistani-born US citizen who tried to blow up a car in Times Square was put on the no-fly list. But the TSA required essentially that airlines check the list only once a day. So although Shahzad’s name was added to list, the airline did not check the no-fly list for any new names at 6:30 p.m. when he made his reservation, or at 7:35 p.m. when he bought his ticket at JFK – again with cash. A routine post boarding check at 11:00 p.m. showed that he was on the no-fly list. So minutes before take-off, he was pulled off – another near miss. Another near-miss has resulted in more changes. Airlines will now have to check the list within two hours of additions.

If confirmed, John Pistole will be charged with fixing this troubled agency. Famously, he is President Obama’s third candidate. The first nominee, Erroll Southers, withdrew after it became apparent he would probably not win confirmation in the wake of reports that he had authorized a background check involving a family dispute. In March, Retired Army Maj. Gen. Robert Harding also withdrew after controversy erupted over his past as a defense contractor. Pistole, a career FBI guy whose work as focused on counterterrorism, is a safe pick, undoubtedly a confirmable one. And maybe, if confirmed, he’ll finally make good on his predecessor’s pledge, solemnly given Congress, that America’s skies would be safe from terror, and that someone on the “No Fly” list “will not fly.” That was back in 2006.

Judith Miller is a writer, Manhattan Institute scholar and Fox News contributor.

Fox Forum is on Twitter. Follow us @fxnopinion.