CIA Director William J. Casey was determined to expand and maintain human sources within governments friendly to the United States. It was risky but essential to spy on friends if he was going to give the White House a full, true picture of the world.

A good, reliable, well-tested human source who sat at the highest-level meetings of a government was often more useful than a pile of verbatim transcripts from electronic eavesdropping. Words of leaders, even those delivered in the most intimate of forums, meetings or phone conversations, might not tell the real story. A good human source could sift through facts, penetrate smoke screens, sort out the conventional wisdom. He was the truly coveted asset, a 24-hour-a-day on-duty warning system.

Developing human sources was a time-consuming, delicate business that often meant waiting for the right opening. Some of the best opportunities came in the most politically unstable regions of the world -- Asia, Africa, the Middle East and Latin America. Numerous Third World leaders feared destabilization efforts from both internal and external forces -- coups, terrorism, assassination. Almost universally, these regimes wanted protection. That meant training, expertise and equipment, and no country was better equipped to provide such protection than the United States. And no arm of the U.S. government was more experienced in aiding leaders secretly than the Central Intelligence Agency, an expertise that went back to the agency's earliest days.

Over the years, the CIA had developed extensive programs to provide security assistance and intelligence training to foreign governments. These programs were designed to preserve the regimes, not to change them. Nonetheless, any CIA effort to influence events in a foreign country was considered "covert action" and required a formal presidential order, called a "finding"; security assistance and intelligence training were included in that definition.

At a cost from $300,000 to more than $1 million, the CIA sent in a team, often only three or four agents. Run by the CIA's special International Activities division, with assistance from the Office of Technical Services and the Directorate of Operations, the team would set up the training and delivery of equipment.

Training was given to the personal security force or palace guard and, often, to the country's intelligence service or the local police. Equipment included the best automatic weapons and handguns; high-tech night-vision equipment; walkie-talkies and the most advanced communications gear, often with encryption capability; a helicopter; security alarms, locks and lightweight bulletproof vests, similar to ones worn by agents who protect the president of the United States and, occasionally, by the president himself. Advanced techniques in perimeter defense of a building or palace, in monitoring terrorists and in ensuring liaison with the intelligence service and the police were also passed on.

One such covert assistance program was in place in Morocco, where for years the CIA had provided technical assistance and training to King Hassan II. (During World War II, a young U.S. military officer, Vernon A. Walters, had met the young Crown Prince Hassan, then age 13. That began a friendship that extended to the period 1972-76, when Walters was deputy director of central intelligence, and was almost considered the king's case officer.) The CIA assistance program had helped to keep Hassan in power since 1961; his rule was one of the longest of any African state.

In return, Hassan allowed the CIA and the National Security Agency, which intercepts communications worldwide, to have virtually free run of his country. Extensive, sensitive U.S. intelligence operations with advanced technologies were set up in Morocco. This was particularly important given Morocco's strategic location at the Strait of Gibraltar, controlling the western entrance to the Mediterranean.

In effect, the United States and the CIA station in Morocco -- and the stations in many other countries -- were saying, "We are your friend and we want to take care of you." In highly volatile domestic political environments, this CIA assistance could mean survival.

Once invited into the presence, office, palace and life of a leader, the CIA team learned a great deal -- schedules, routines, the identities of those with real influence and real information, the quirks and peccadilloes of the friendly leader, his family, his advisers. There were also opportunities to plant eavesdropping devices, and the communications gear issued to the security and intelligence forces was known to the CIA and NSA, as were its precise uses, its frequencies and, if applicable, the codes.

But perhaps most important, there was a chance to recruit those human sources. The visiting CIA team or the station personnel had access to the people at the working level -- guards, radio operators, others in key positions. Training sessions, discussions, meetings, long lunches, longer dinners were all part of protecting the leader, honing the skills, learning the equipment, sharing the risk, the purpose.

The result was often effective and multiple penetrations, human "moles" or electronic devices in many key friendly countries. Some CIA people considered this extremely dangerous -- little more than intelligence "sting" operations designed less to help the leader than to gather intelligence. But Casey felt it would be criminal not to use the advantage that had been handed to them. At various times he called these operations "a duty" and "business." The United States was vulnerable, he said.

Once inside a foreign country, CIA officers were free to conduct espionage. There was only one rule, Casey said: "Don't get caught. If you do, don't admit it." Some critics within the agency, however, felt that Casey paid too little attention to the consequences of exposure. But that was just the kind of mentality Casey was fighting: he wanted offense, not defense; boldness, not caution.

Enhancing the power of his chiefs of station abroad was another of Casey's goals. Nothing increased a station chief's power and status within the country and at CIA headquarters in Langley as much as the security and intelligence-assistance operations. Station chiefs were given a laminated plastic card that listed available services, including head-of-state protection. The card was handed to heads of state so that they could select from the menu. Successful operations gave the station chiefs fantastic power within the U.S. embassy, particularly if the security operation yielded good political intelligence from the presidential palace.

In 1983, the ever-changing list of major recipients of this intelligence and security assistance numbered about 12. At that time, it included:President Hissene Habre of Chad, the former French colony south of Libya. Libyan leader Moammar Gadhafi was spearheading a campaign to overthrow the Habre government. Habre came to power in 1982 after receiving covert CIA paramilitary assistance under one of the early Reagan administration findings designed to keep Gadhafi boxed in.Pakistani President Mohammed Zia ul-Haq. No leader ruled a country in a more precarious geographic situation. It was virtually surrounded by unfriendly nations -- Iran to the west, Afghanistan to the north, bitter foe India to the east and south and the Soviet Union just a few miles beyond the Afghan border. The CIA station in Islamabad, the capital, was one of the biggest in the world; it funneled growing amounts of paramilitary support to the rebels in Afghanistan fighting against their Soviet-dominated government.Liberian leader Samuel K. Doe. The deputy chief of Doe's personal guard, Lt. Col. Moses Flanzamaton, became a CIA agent and later, in 1985, attempted to seize power by leading a machine-gun ambush on Doe's jeep. Doe was not injured, but Flanzamaton was captured, confessed to CIA ties and embroidered his tale to include CIA sponsorship of the assassination. It was white knuckles at Langley for days, where top officials feared that the agency would be accused unfairly of an assassination attempt. But Flanzamaton was executed a week after the coup attempt, and the agency's fears went unrealized.Philippine President Ferdinand Marcos, a key U.S. friend, who permitted the United States to maintain air and naval bases. Marcos was also dealing with a communist insurgency. Marcos' rule ended last year when he fled the Philippines.Sudan President Jaafar Nimeri, who maintained close relations with the United States and was another barrier to Gadhafi in Africa. He was overthrown by his defense minister in an April 1985 bloodless coup.Lebanese President Amin Gemayel. The CIA was anxious to ensure that he was not overthrown or killed like his brother, Bashir Gemayel, who died in a bomb explosion shortly before he was to take office as president in September 1982.

There were more -- some obvious, some not so obvious. But in Casey's bag of intelligence operations, the security-assistance operations were among the best.

Casey felt that he had to be the unremitting advocate for these covert actions and relationships, even if they counted only for marginal gain, or if there were no apparent gain. It was a way of getting the agency's foot in the door, and as far as Casey was concerned the CIA needed its foot in every door in the world. Could these arrangements go too far? Yes, he realized, at least theoretically. So how were they to be controlled? Casey's answer was simple. He would become personally involved in monitoring them.Outmaneuvering Mubarak

The value of knowing the habits of a friendly foreign leader became evident in October 1985, when four Palestine Liberation Organization terrorists hijacked an Italian cruise ship, the Achille Lauro, with 438 passengers aboard. An American, Leon Klinghoffer, 69, was murdered in his wheelchair and thrown overboard. Eventually, the cruise ship docked in Egypt.

U.S. intelligence agencies had a longstanding relationship with Egypt and had supplied its president, Hosni Mubarak, with a secure communications system. Mubarak hated the system. It had a push-to-talk handset, so that the person on the other end could not receive while talking. That made it hard to interrupt. So Mubarak frequently used an ordinary phone, which made eavesdropping by satellites relatively easy.

Mubarak had been saying publicly that the hijackers had left Egypt. But early on the morning of Oct. 10, one of Mubarak's phone conversations was intercepted by satellite, the result of stepped-up intelligence gathering ordered after the ship was seized. The intercept told a different story. Mubarak was overheard telling the foreign minister that the hijackers were still in Egypt. He shouted that George P. Shultz, the U.S. secretary of state, was "crazy" to think that Egypt would turn over the hijackers to the United States as requested. Egypt was an Arab country and could not turn its back on its PLO brothers.

During the afternoon, the NSA provided 10 intercepts of Mubarak discussing final plans to deliver the hijackers to the PLO in Algiers. The transcripts showed Mubarak's distress as he maneuvered. At first he had not known of Klinghoffer's murder; when he found out, he realized the United States would have to act.

Shortly after midnight local time, four U.S. planes forced an Egyptair plane down in Sicily, and the hijackers were captured. It was President Reagan's first clear-cut victory over terrorists, and he was flooded with praise from the public, Republicans and Democrats. Knowing the importance of the intercepts, the next time the president saw Casey, the commander in chief almost bowed before his director of central intelligence. Recruiting Soviet Sources

While spying on friends was useful, even necessary, the project of paramount importance to Casey was recruiting and developing human sources in the Soviet Union. That would be the trophy.

Casey understood the limits. It was hard to operate in Soviet society; it was possible to get more information and still not have answers to the big questions, such as the true Soviet intentions. It was also hard for the Soviets to understand the intentions of the United States. There was probably a KGB analyst in Siberia now because he had failed to predict that a peanut farmer would oust an incumbent U.S. president in 1976, and another for failing to predict that the peanut farmer would be ousted by a Hollywood actor and that this would lead to the biggest peacetime military buildup in U.S. history.

In 1980, after Casey had agreed to take the CIA directorship, he had consulted William E. Colby, who had been director of central intelligence from 1973 to 1976. "Don't forget," Colby had stressed to Casey about the Soviet Union, "work to get real penetrations there. It's tough." Get to the sacred circle of Soviet leadership. No one has been able to, but you might do it. Speaking to a man Colby knew to be famous for taking financial and business risks, he baited Casey by saying: "It's worth taking a few losses."

Any penetration of the Soviet Union by the CIA could turn out to be a double agent, Colby said. "If you get a bad one on occasion," he advised, "you'd get five good ones in the meantime -- you get burned once in a while but continue."

There were also walk-ins. Casey found too much suspicion about walk-ins. Because of his strong belief in democracy and the capitalist system, Casey felt it was the most natural thing in the world for a Soviet or Eastern Bloc official to want to assist the West. Sure, the CIA had to be careful that they were not plants or double agents, but Casey felt it was important to let it be known that the door in every station or facility was open. Besides, a walk-in had advantages: you could get down to business in a short time; years of nurturing and foreplay, which itself could be indirect and ambiguous, were not necessary.

Casey pushed hard, raising the question of human-source recruiting time and again with the elite Soviet division in the Directorate of Operations. He made it clear that he was willing to take chances. Yes, he said, there would be mistakes. He expected mistakes. He expected that some Soviets might be offended. "So what?" he said. "Proves we're active." If there were no mistakes, there was not enough effort. Every lead had to be followed up. No hint, clue, tip or intuition was to go unexamined as they sifted Soviets' names and files for possible recruits. This was the long, deep game with the major adversary.

By 1984, Casey had more than 25 human sources regularly reporting within the Soviet Union or the Eastern Bloc. Nearly all had been developed during his time. The sources were in the military, KGB or Eastern Bloc intelligence services, the scientific fields or other walks of life.

Casey was particularly proud of one of these sources. When the handful of U.S. officials on the BIGOT list (a group with access to the most sensitive intelligence material) learned of the source's status, they were very impressed.

But in general, Casey's successful Soviet penetrations were not viewed as terribly significant in the White House, where there was much grumbling -- particularly by the national security advisers -- because there was no intelligence flow directly from the Soviet Politburo.

In March 1985, using new techniques, Casey received one of the most important intelligence reports of his tenure. It was from inside the Soviet Union. The CIA had been monitoring the long illness of Soviet leader Konstantin Chernenko, who had been in office a little more than a year. The report said that he had died, but that the news was being kept from the Soviet people, and the rest of the world, while the Politburo selected a new leader.

Casey sent the report to the White House. Several days passed. There was no confirmation, but Casey had faith in the source. On Sunday, March 10, a senior Soviet official visiting the United States was called home, and the next morning came the unmistakable signal: classical music on Radio Moscow. At 6 a.m., the leader's death was announced. Four hours later, the Soviets said that the youngest member of the ruling 10-member Politburo, Mikhail Gorbachev, 54, had been selected as the new general secretary. The quick resolution of succession suggested that the CIA's source had been correct and that Chernenko's death had been covered up for several days.

In a certain respect, this was an intelligence coup for the CIA; there was no more important intelligence task than monitoring the Soviet leadership. But the absence of confirmation or other details only made the real intelligence gaps that much more evident. What was the White House to do with this information?

Moreover, the agency knew virtually nothing about the succession debate or the man who had emerged as winner. News reports were hailing Gorbachev as the new Soviet man, pragmatic and open. Casey was sure that was only superficial, and he told the White House to be wary of appearances. But he had little inside information to support his warning. 'The Year of the Spy'

At the same time Casey was making progress in developing human sources overseas, he found himself with several serious counterintelligence failures. By the end of 1985, a half-dozen arrests had been made involving espionage against the United States. The news media dubbed it "The Year of the Spy."

The reality was worse than what was known publicly. Internal investigations at the CIA and other U.S. intelligence agencies showed that there had been early warnings of some of the espionage.

Before Casey's tenure, in the late 1970s, Adm. Isaac C. Kidd, commander of the Atlantic Fleet, had been alarmed that Soviet submarines seemed to react to U.S. exercises as if they were reading the U.S. Navy's classified message traffic. Kidd had his intelligence officers prepare a report, which concluded that there was a leak -- probably a radioman with broad access to sensitive material. The NSA examined the report, but there was no follow-up. It was not until 1985 that former Navy man John A. Walker Jr. and his spy ring were exposed -- by Walker's wife, who had tipped off the Federal Bureau of Investigation.

In 1984, Casey had received a cable from the CIA's Moscow station chief saying that something was terribly wrong. Human sources were drying up, long-established technical collection projects were suddenly silent. The station chief's report was like the opening of a spy novel, but no one knew what to do. There seemed to be no clue.

It was not until November 1985 that some of the mystery was solved. Soviet defector Vitaly Yurchenko, a top KGB official, helped unmask Edward Lee Howard, a CIA operative who had been fired on the eve of a scheduled assignment to the Moscow station. Howard was declared a security risk after a polygraph examination suggested that he had problems with heavy drinking, continuing drug use, womanizing, even petty theft. After his firing, Howard sold out to the KGB.

Yurchenko also helped identify Ronald W. Pelton, who had worked for the NSA from 1965 to 1979, then sold out to the Soviets for $35,000. Pelton had the broadest possible access to the sensitive code-word information concerning 60 Soviet communications links targeted by the NSA. He had provided the Soviets with information on a U.S. operation called Ivy Bells, an undersea tap on a key Soviet communications cable in the Sea of Okhotsk, off the east coast of the Soviet Union.

The Ivy Bells operation had worked until 1981, when NSA authorities surmised that the equipment was in Soviet hands. A 1982 report, which was so classified that only a few people had access to it, ruled out coincidence or luck. The Soviets had gone to the exact spot where the tap had been placed; there had to have been a leak. The Soviets had a source somewhere, the report concluded.

But no one knew how until Yurchenko, who later escaped from a CIA escort and defected back to the Soviet Union, provided the clues. NEXT: A sickbed conversation Barbara Feinman, of The Washington Post, was research assistant for "VEIL: The Secret Wars of the CIA, 1981-1987."

1987 by Bob Woodward, published by Simon and Schuster Inc. All rights reserved.