The first secret James Woolsey was told when he took up the job of director of the CIA two years ago was that it had been penetrated by a mole. Aldrich Ames is now in jail serving a life sentence but his exposure - and revelations about the bumbli ng efforts to identify him in the nine years he worked for Moscow - have done more damage than any other of the numerous scandals in the CIA's history.
Mr Woolsey's failure to appreciate the political damage done to the CIA by the Ames case led directly to his downfall this week. It alienated Congressional leaders and undermined popular support. By refusing to fire anybody for the failure to unmask Amesearlier, he led Congress to take the reform of intelligence into its own hands by setting up a non-partisan commission.
Even as the White House was considering Mr Woolsey's letter of resignation sent at the weekend, official Washington was astonished to switch on its television sets and find an hour-long interview with Ames being broadcast on CNN. Speaking from his federal prison in Pennsylvania, he praised his Russian handlers and said there were "probably" other foreign moles still working for the CIA.
The interview did not lead directly to Mr Woolsey's departure. This was the result of mounting pressure from Congress and within the CIA. The White House, which never liked Mr Woolsey very much, was nevertheless upset that he should have chosen this moment to resign when President Bill Clinton is trying to stabilise his administration. Now, on top of all the problems he is facing in dealing with an incoming Republican Congress, he has to find a new CIA director.
The CIA has faced many scandals and failures before. In the early 1960s it tried to assassinate Fidel Castro. In 1973 it helped to overthrow the elected socialist government of Salvador Allende in Chile. In 1986 its director Bill Casey was involved in illegally shipping weapons to Iran, using the money to fund rebels in Nicaragua. But all these efforts, even when laws were broken, could be defended by the CIA and its friends as being the result of excessive anti-Communist zeal.
The Ames scandal is more damaging because it has made the CIA a figure of fun. Since revelations about its agents spying on Americans opposed to the Vietnam war, the Democrats have always regarded the organisation with deep suspicion. But now the CIA is under attack from both left and right.
The CIA's own report on the Ames case showed an organisation that is highly introverted. As Ames admitted this week, he was peculiarly "sloppy". On one occasion he loaned his lap-top to a colleague so that he could play computer games, forgetting that onthe same disk he was storing classified information to pass on to the KGB. The colleague did notice this - including the name of Ames's Russian case officer - but failed to draw any damaging conclusions.
Such episodes have begun to make the CIA a target for cartoonists, eroding its air of mystery and glamour. It has also lost its main enemy with the collapse of the Soviet Union. The same is true of the rest of the American security establishment that grew up after Pearl Harbor to fight the Second World War and the Cold War from 1946 to1991. However, the Pentagon, defending a $270bn (pounds 175bn) budget, has been far more successful than the CIA in fighting off reform. President Clinton recently promised the armed forces an extra $25bn and the incoming Republican leaders say this is not enough.
Why has the CIA been so much less successful than the armed forces in protecting itself against the consequences of the collapse of Communism? The United States now accounts for more than half the world's military expenditure, so it should be easier findarguments for cutting armoured divisions intended to stop a Soviet armoured thrust into Western Europe than to reduce political intelligence in a more …