William J. Casey, 74, a former director of central intelligence and a major figure in the Reagan administration's support of the Nicaraguan contras and its arms sales to Iran, died of pneumonia and cancer yesterday at Community Hospital in Glen Cove, N.Y.

In 1981, Casey became the "father" of the Nicaraguan contras, created in that year to oppose the communist-backed Sandinistas in Managua. The operation was known in the intelligence community as "Casey's war." Despite opposition in Congress and the eventual cutoff of U.S. funding in 1984, Casey never wavered in his support of it.

As the first director of central intelligence to be given Cabinet rank, he used his prominence and his friendships in the administration to support the covert sale of arms to Iran from the time it was proposed in 1985 until the operation ended in 1986.

Supplying weapons to Iran and paying ransom for hostages were contrary to U.S. policy. Those opposing these steps included the secretaries of state and defense. Although Casey denied it, a number of investigators believe he was behind the diversion of funds from the arms sale to Iran to the contras. Illness prevented him from appearing before the Tower Special Review Board that reported on the matter at the president's request. Casey's death now means that Congress and the independent counsel investigating the Iran-contra affair will be deprived of his testimony and this may mean enormous gaps in public knowledge about the controversy.

But Casey played an unintended role in bringing the Iran-contra affair to light last November. Secretary of State George P. Shultz learned that Casey was about to testify to the Senate Select Committee on Intelligence that the U.S. government had no knowledge of a shipment of Hawk antiaircraft missiles from Israel to Iran in November 1985. The testimony, which was prepared by the CIA and the National Security Council, said officials believed the cargo consisted of "oil drilling equipment."

In fact, the government had full knowledge of the transaction. In a dramatic meeting with the president, Shultz warned that the administration was on the verge of lying to Congress. Together with a parallel appeal from the Justice Department, this caused Attorney General Edwin Meese III to investigate. Four days later, Meese made the stunning announcement of the Iran-contra connection.

Meanwhile, Casey's testimony was rewritten. But when he spoke before the Senate committee he sometimes seemed confused. It has been suggested that this may have been because of his illnesses.

President Reagan issued a statement yesterday in which he said that with Casey's death, "America has lost a patriot and the cause of freedom an able champion.

"In addition to crediting him with rebuilding America's intelligence capability," the president said, "history will note the brilliance of his mind and strategic vision, his passionate commitment to the cause of freedom and his unhesitating willingness to make personal sacrifices for the sake of that cause and his country."

Sen. Daniel Inouye (D-Hawaii), the chairman of the Senate committee investigating the Iran-contra connection, noted Casey's death as the panel opened its second day of hearings.

Inouye said: "In the coming weeks, as our testimony unfolds, Mr. Casey's name will be heard frequently . . . . Whatever may be the final judgment of his role in this event, it should not obscure Mr. Casey's distinguished record of commitment to this country."

The CIA issued a statement saying, "We have benefited from his leadership and we shall miss him."

In October 1985, Casey learned he had cancer of the prostate. In December 1986, he underwent surgery at Georgetown University Hospital in Washington to remove a cancerous brain tumor. He resigned as head of the CIA on Jan. 29.

Casey, who first served Reagan as his presidential campaign manager in 1980, had a special understanding of the president's view of the world. That was one of the main reasons for his influence in administration councils. A self-made millionaire, he shared Reagan's faith in business and capitalism and his determination to oppose communism.

He was a principal architect and implementer of the "Reagan Doctrine" of support for anticommunist resistance movements. During Casey's stewardship the CIA backed insurgencies in Afghanistan, Angola, Cambodia and Ethiopia as well as in Nicaragua. In his work at the CIA he made private use of an astonishing array of friends and acquaintances in and out of government in this country and abroad.

A New York lawyer and businessman who held high office in the Nixon and Ford administrations, Casey was energetic, demanding, charming and sometimes profane. He also was a lover of books and a reader of omnivorous tastes. He was a writer, an editor, a scholar and the author of a history of the American Revolution. In his public life he frequently attracted the attention of congressional investigators, a circumstance he termed outrageous.

"I'm high on the free-market system, instead of the quasicollective systems," he told The Washington Post in an interview in 1983. "I think a nation should promote its values in the world, protect its security and set an example among nations not seeking expansion."

A World War II veteran of the Office of Strategic Services, the predecessor of the CIA, Casey was fascinated by undercover operations -- the "dirty" side of the business -- as distinct from intelligence operations: gathering information from satellites, for example, or from published sources. Toward the end of the war he was at the center of cloak-and-dagger activities as the official in charge of infiltrating agents into Nazi Germany.

He kept up OSS contacts in subsequent years and served on the President's Foreign Intelligence Advisory Board in the mid-1970s. In the late 1970s, he wrote an as yet unpublished manuscript titled "The Clandestine War Against Hitler." It is a personal account of his intelligence activities and those of Gen. William J. (Wild Bill) Donovan, the head of the OSS.

Thus, Casey was comfortable at the CIA. He told The Post in 1984 that the agency "is something unique in the world. Its depth was created over 25 years, then it went through a time of bad criticism -- sensational, inaccurate, unfair and distorted. The government turned its back on intelligence, and the process of gathering it. I want to restore the earlier, good days."

In the old days, secrecy was sacrosanct. But a series of investigations in the 1970s showed the CIA had engaged in plotting assassinations of foreign leaders and monitoring domestic political groups. Presidents Ford and Carter ordered restraints on the agency and Congress asserted its right to be kept informed. But for Casey, keeping the agency's secrets was more natural than accounting for its operations to intelligence oversight committees on Capitol Hill.

And in the informal, ad hoc process by which the administration sometimes formed policy, he relished opportunities to make an impact. Where the State and Defense departments seemed to hesitate, he wanted the CIA to be the "can-do" arm of the government. This transformed morale at the CIA.

His relations with Capitol Hill, however, never rose much above the level of profound mutual suspicion. "Don't brief, limit disclosure," he told an associate. And he was supported by President Reagan, who signed an order directing him not to disclose the Iran arms sales project to the congressional intelligence committees.

In November 1985, Casey told Congress its oversight prerogative had caused "repeated compromise of sensitive intelligence sources and methods." Last year, he threatened possible legal action against this newspaper, four other publications and NBC News for allegedly disclosing electronic intelligence operations.

William Joseph Casey was born in Elmhurst, N.Y., on March 13, 1913. He grew up in Queens, N.Y. One of his boyhood pastimes was reading about Horatio Alger and Buffalo Bill. He graduated from Fordham University in 1934 and received a fellowship to study social work at Catholic University. He put himself through law school at St. John's University, finishing in 1937. "A lawyer has a ringside seat at the human comedy," he once said.

In his youth, Casey said, he was interested in "distributive justice" and utopian socialism. He said the Jesuits at Fordham and President Franklin D. Roosevelt's effort to "pack" the Supreme Court in 1937 caused him to turn away from these ideas.

"I pass the test," he used to say, "that says a man who isn't a socialist at 20 has no heart, and a man who is a socialist at 40 has no head."

In 1940, he broke into politics writing speeches for Wendell Willkie, the Republican presidential candidate that year.

From 1937 to 1950, Casey was chairman of the board of editors of the Research Institute of America, and, from 1954 to 1971, he was president and editor of the Institute for Business Planning. He wrote and published a number of highly successful tax, real estate and business guides and those were the foundation of his fortune. From 1950 to 1971, he also practiced law in New York City.

During World War II, Casey was commissioned in the Navy and assigned to the OSS. In 1943, Gen. Donovan sent him to London. His colleagues there included Richard Helms and William Colby, both of whom later headed the CIA. For his service he won the Bronze Star.

Helms said years later that Casey had a feel for things clandestine. He also said he admired Casey's ability to make hard decisions.

For the rest of his life, one of Casey's cherished possessions was a letter from Donovan that said: "You took up one of the heaviest loads which any of us had to carry at a time when the going was roughest, and you delivered brilliantly."

In 1966, with the encouragement of Leonard Hall, who was his law partner and a respected Republican National Committee chairman, Casey ran for Congress. He was defeated in the Republican primary by Steven B. Derounian, whom he tried to portray as a reactionary by using a picture of the back of Derounian's bald head.

From 1971 to 1973, Casey was head of the Securities and Exchange Commission. His next job was the chairmanship of the Export-Import Bank. In 1974 he went to the State Department as undersecretary for economic affairs in the Ford administration.

At the end of 1976, Casey returned to New York to practice law. His first contact with Ronald Reagan was at a breakfast in 1980. The two hit it off so well that when John Sears was fired as Reagan's campaign manager, Casey was asked to take his place.

The campaign apparently involved some dirty tricks. One incident that received considerable attention when it was disclosed some time later was the purloining of papers used to brief President Carter for his debate with Reagan. James A. Baker III, then a key White House aide and now secretary of the treasury, said he got the documents from Casey's office at campaign headquarters. Casey denied he ever had seen them.

At the CIA, one of Casey's first acts was to prove controversial. He appointed Max Hugel, a New York businessman, to head the crucial operations directorate, which is responsible for all undercover activities. In the past the job had always gone to an intelligence professional. Despite advice from friends and colleagues, Casey stuck by Hugel until the latter voluntarily resigned because of disclosures about his business activities.

In the wake of this incident, the Senate intelligence committee conducted an extensive investigation and concluded that Casey was "not unfit to serve" at the CIA. In 1983, it was learned that Casey had bought and sold $7 million in stocks in 1982 and it was noted that as director of central intelligence he had access to the most sensitive economic information. The director vehemently denied any wrongdoing, but he put his investments into a blind trust, a step he had refused to take earlier.

It also came to light that in 1959 Casey was accused in a lawsuit of plagiarism in one of his business books. The case eventually was settled out of court.

At the CIA, Casey could count among his successes the fact that he tripled the agency's budget. He also reorganized the directorate of intelligence, the analytical arm, and initiated a sixfold increase in the number of studies it conducted. On the operational side, the agency predicted Israel's invasion of Lebanon in 1982 and it forecast that Yuri Andropov would succeed Leonid Brezhnev at the helm of the Soviet Union.

But it did not warn against the terrorist attack on the Marine barracks in Beirut in 1983 or predict that Konstantin Chernenko would succeed Andropov in the Kremlin. Other failures were the publication of CIA plans to conduct preemptive strikes against terrorists and the disclosure in the press of a "disinformation" campaign involving the CIA that was authorized by the president to undermine Moammar Gadhafi of Libya.

Casey took a particular interest in the analytical function at the CIA and he sometimes edited the reports himself. In material he prepared for the Senate in connection with his confirmation hearings in 1981, he wrote, "During my entire working life my activities as a lawyer, author and editor have involved the gathering, analysis and evaluation of information and applying it to practical purposes." He returned one 1984 assessment on Mexico for revision nine times.

His penchant for detail extended to Nicaragua. One colleague said Casey acted as his own deputy director and deputy for intelligence and operations.

By 1984, when Congress finally cut off all U.S. funding, the contra forces had reached their peak of about 15,000 guerrilla fighters. At first, the administration said the United States was helping them interdict arms aid the Managua government allegedly was providing to leftist insurgents in El Salvador. Congressional critics said the real purpose was to overthrow the Sandinistas and they warned against the United States getting into "another Vietnam."

As this view gained momentum, Casey tried to contain congressional interference by backing a measure introduced by Rep. Edward P. Boland (D-Mass.). The "First Boland Amendment," as it came to be called, permitted aid to the contras so long as it was not used to overthrow the Nicaraguan government or start a conflict between Nicaragua and Honduras. It became law in December 1982.

In theory, it governed U.S. actions with respect to the contras. Casey reportedly remarked, however, that "it doesn't prohibit anything" and in 1983 the contras were hitting targets inside Nicaragua. Gradually, the real U.S. role became known.

In April 1984, Casey faced one of his worst crises when the Senate intelligence committee learned it had not been fully informed about the CIA mining of Nicaraguan harbors. A second crisis occurred in October 1984 when it was disclosed that the CIA had prepared a training pamphlet that included material on assassinations and changing governments by force.

The response of Congress was the "Second Boland Amendment," which became law on Oct. 12, 1984. This prohibited the CIA, the Defense Department "or any other agency or entity of the United States involved in intelligence activities" from "supporting, directly or indirectly, military or paramilitary operations in Nicaragua."

With the passage of this law, administration officials began to seek unofficial ways of supporting the contras. The diversion of funds from Iran to Central America was a result.

Casey "wanted the contras to win, and everything in his heart told him it was possible," an associate said. "But the pragmatic side told him it was impossible."

His commitment to the contra cause was apparently impressed upon his family; a paid death notice in The Washington Post today suggests that "in lieu of flowers, donations may be made to the William J. Casey Fund for the Nicaraguan Freedom Fighters" in care of his wife.

In addition to his business books, Casey's published works include "Where and How the War Was Fought, An Armchair Guide to the American Revolution."

Casey, who maintained residences in Roslyn Harbor, N.Y., McLean and Florida, is survived by his wife, Sophia Kurz Casey, a daughter, Bernadette Casey Smith, and a sister, Mrs. Fred Nimmich of Garden City, N.Y.

A friend once asked him what he would like to be doing if he could have his fondest wish, and Casey replied: "Dropping spies into Germany."