Having won a big 2005 budget increase for NASA — with a lot of help from Rep. Tom Delay (R-Texas) and Sen. Ted Stevens (R-Alaska) — and nearly unprecedented spending flexibility for his successor, NASA Administrator Sean O’Keefe has decided to leave on a high note for the much greener pastures of academia. He has every right to do that, but he is leaving at a critical time in NASA’s history and dumping some major decisions squarely in the lap of the next administrator.

If the Bush administration wants to avoid an unmitigated disaster at one of its most visible agencies, it should insist that Mr. O’Keefe stay put — as he has promised to do — for as long as it takes to find someone who is highly qualified for the job and prepared to make some very difficult decisions very quickly.

Over the course of the next year, Mr. O’Keefe’s successor will have to ensure that NASA is ready to start flying space shuttles again, and then try to get the international space station on track. By late summer or early autumn , NASA will have to either commit to a Hubble Space Telescope servicing mission or back away and face the political heat for doing so.

The next NASA administrator also will have a very tough fight getting the agency’s 2006 budget request through Congress, especially if that request includes the 5 percent increase contained in the administration’s current five-year spending plan for NASA. Given the rising U.S. budget deficit and the fact that no other non-defense agency is getting any significant increase, it will be a long uphill fight.

Those are just for starters. As good as it is, the 2005 budget is not enough to fund all of NASA’s current plans and commitments because of the rising cost of returning the shuttle to flight, the prospect of an expensive Hubble servicing mission and the addition of more than $400 million in pet projects for members of Congress.

Something else will have to be cut and that will mean more fighting within the agency and with members of Congress concerned that jobs in their district might be cut.

Mr. O’Keefe’s legacy is a mixed bag made up of a lot of unfinished business.

When he began his tenure three years ago, Mr. O’Keefe promised to restore NASA’s credibility. At the time, few members of Congress trusted anything the agency told them, particularly when it came to program costs.

That mistrust was more than justified by NASA’s repeated failure to deliver any major program on time and within budget. Mr. O’Keefe’s initial focus — and rightly so — was bringing the runaway cost of the international space station under control. While his unilateral decisions frustrated and angered some of NASA’s partners in Europe, he succeeded, at least in the short term. He stanched the bleeding and tried to match the agency’s ambitions for the space station with fiscal reality.

He also set about the unenviable task of unraveling the hodgepodge of financial accounting systems across NASA that made sure no one could ever tell with any precision how much the agency was spending on what programs from year to year.

He then began focusing on returning NASA to its roots as a research and development agency, an effort that was sure to stir up controversy in an institution that was still living in the fading glow of its glory days in the 1960s.

Those were enormous challenges, and all three remain works in progress. As fate would have it, that first year, as difficult as it was, would turn out to be the good old days.

NASA’s priorities disintegrated in the skies above Texas Feb. 1, 2003, as the Space Shuttle Columbia broke up during re-entry, killing its crew.

That changed everything. NASA’s financial reform and space station cost-control efforts wound up at the bottom of a much longer list of very difficult problems that Mr. O’Keefe is leaving behind for others to finish.

The next NASA administrator would ideally possess three key qualities: political savvy, technical literacy and a successful track record managing a large, complex organization.

Political skill is needed not just for the budget process, but also to make lasting changes in NASA’s priorities that are likely to affect jobs in the districts of influential members of Congress. That is something Mr. O’Keefe failed to take into account when he canceled the Hubble servicing mission. Technical literacy will help the administrator ask the right questions about things like shuttle safety and programs that are behind schedule. Finally, running NASA is like herding cats, and the next administrator will need a wealth of managerial experience to keep everything moving in the right direction.

Few people possess all three skills. Given the importance of the job, the White House should leave no stone unturned in its search for someone who does. Failing that, the White House certainly can find someone who excels at two of the three and then find a strong deputy administrator to fill any gaps.