In April, James L. Pavitt became the first director of the CIA's clandestine service ever to testify publicly before Congress. While he was not technically undercover as the deputy director of operations, just about everything he was in charge of for five years was.

Having retired in August after 31 years at the CIA, Pavitt has become the agency's most senior public advocate, defending the spies and analysts who have come under attack by Congress, the 9/11 commission, the White House and, most recently, their new CIA director, former House Intelligence Committee chairman Porter J. Goss.

Pavitt thinks invading Iraq "was the right thing to do" because, even though no weapons of mass destruction were found and no direct link to al Qaeda was established, Saddam Hussein had tried to assassinate former president George H.W. Bush.

"Were they terrorists in their own right?" he said. "Yes, I believe they were."

At the same time, Pavitt believes the postwar occupation has been marred by misguided initial decisions to exclude the State Department from managing relations with an emerging Iraqi leadership, as well as decisions to disband the army and disqualify all former Baath Party members from working in the new government.

The way the United States encouraged reconciliation of former Communist Party members in Eastern Europe after the Soviet Union dissolved "offered some insights on the way we could deal with Iraq," Pavitt said in the first lengthy newspaper interview since his retirement. "Not everyone who was a Baathist was an ardent supporter of Saddam Hussein, or some kind of criminal. There were people who felt they had to be part of the party."

Earlier this year, the Bush administration softened its de-Baathification program. It has also allowed some former military officers to join the new army and has put a U.S. ambassador in charge of the reconstruction and of nonmilitary U.S. relations with Iraq's interim government.

But on the more general chaos of the occupation, Pavitt said the CIA "made it clear, as I recall it, that the possibility and prospect for insurgency was real and genuine."

"The window we had on the ground in Iraq after the fighting stopped was a brief window. . . . Anyone who believed we could walk into Baghdad and be greeted as liberators for very long, I think simply didn't know very much about the history of Iraq. . . . Trying to hold Iraq together with concepts that are important to us -- democratic institutions and so forth -- is going to take some time. I don't think anybody should be surprised it's rough going," he said.

To succeed in Iraq now, he said, sitting in his family room in front of a crackling fire and surrounded by original art that he has collected over the years, "will require flexibility, perhaps more flexibility than we've seen in the past."

Pavitt's directorate of operations was responsible for knowing the plans and intentions of Osama bin Laden and other terrorists, for inserting CIA paramilitary units into Afghanistan after the Sept. 11, 2001, attacks, and for sending secret teams into Pakistan, Indonesia, Thailand and Somalia to snatch al Qaeda members with the help of local security forces.

His operatives were the first to fire Hellfire missiles mounted on an unmanned aerial vehicle at an al Qaeda convoy in Sudan, killing them all, including a U.S. citizen. They interrogate the likes of Khalid Sheik Mohammed and Ramzi Binalshibh and have secretly transported dozens of terrorists around the world. They recruited and debriefed foreign agents with information about Iraq's weapons of mass destruction before the war and were assigned to kill or capture the Iraqi leader once the war began.

In the aftermath of Sept. 11, the failure to find weapons of mass destruction in Iraq and the surprisingly strong and growing insurgency in Iraq, Pavitt's department has been chastised frequently, and in public, for what it did and did not do in Iraq and to stop al Qaeda.

In one recent authorization bill, the Republican-led House Intelligence Committee, then chaired by Goss, warned that the CIA's spy operations were headed "over the proverbial cliff" and that "the nimble, flexible, core-mission-oriented enterprise the D.O. [directorate of operations] once was, is becoming just a fleeting memory."

The criticism makes Pavitt bristle.

"I think there needs to be a clearer understanding that human intelligence is extraordinarily valuable, but those who expect perfection out of it will always be disappointed," he said. "If we are right 40 to 50 percent of the time, we're batting pretty well."

Creating a national intelligence director as was proposed by congressional committees and the 9/11 commission, will not necessarily fix the problems, he said. "And to suggest that if we don't act" to create such a director that terrorist strikes against the United States are more likely "is simply not right," he said. "There are no easy fixes."

Terrorism, said Pavitt, "is not going to be gone a year from now. My children, your children are going to have to worry about this a long time from now. If that's true, we're not going to just make it all better, make the nation safer overnight by making a new bureaucratic structure."

Pavitt, who plans to join the private sector soon, although he declines to say in what capacity, said it will take years to train and season the numbers and kinds of American spies the CIA needs to infiltrate al Qaeda -- or, more likely, to recruit foreign agents who can get inside the terrorist group.

"There seemed to be shock and dismay when [former CIA director George J. Tenet] said it would take five years until the human service is healthy again. Spare me! Stop! It's no surprise to anyone," Pavitt said.

Actually, he contends it will take longer: "I can't produce case officers overnight. It takes seven, eight, nine years" before a clandestine case officer is experienced enough to be successful against these toughest of targets.

Although Congress and the White House have given the CIA healthy increases in funding since Sept. 11, Pavitt said too much of the new money, to stay within deficit ceilings, is given in yearly supplemental funds. Without a sustained financial commitment to pay for larger recruiting and training programs, he said, managers cannot put the necessary infrastructure in place.

"It's a hell of a way to run a railroad, by the way," he said. "We've got money now to deal with the crisis of the moment and the crisis of the moment is Iraq and terrorism. There's some other money, but nowhere near the kind of investment that's necessary."

Retired CIA deputy director of operations James L. Pavitt, sitting in his garden, said he will take a job in the private sector.