William Orville Douglas, 81, a retired associate justice of the Supreme Court of the United States and a towering figure in the nation's judicial history, died yesterday at Walter Reed Army Medical Center. He had been hospitalized Chirstmas Eve for treatment of pneumonia and related illnesses.

His work and the length of his service were prodigious. He wrote more than 1,200 opinions, a record, and they earned him a reputation as one of the court's staunchest defenders of individual liberties. At the time of his retirement on Nov. 12, 1975, for resons of health, he had served on the court for 36 years and seven months, longer than any man in history. One third of all the justices to sit on its bench did so while Mr. Douglas was there.

Whether as an associate justice or in many of the other roles of his life -- chairman of the Securities and Exchange Commission, conservationist and outdoorsman, author, world traveler, foundation head -- Mr. Douglas often was the center of controversy. He survived two efforts to impeach him. His writings were denounced as subversive and he was further denounced because some were reprinted in magazines that his detractors thought were obscene. His three divorces and four marriages -- two of them to women young enough to be his daughters -- were criticized.

Harsh as were his critics, Mr. Douglas' supporters were stronger. President Franklin D. Roosevelt, who appointed him to the Supreme Court in 1939 when the nation still was struggling to extricate itself from the Great Depression, considered him as a vice presidential running mate in the 1944 election campaign.

Instead, Harry S. Truman, a senator from Missouri, became vice president and then president. Truman offered Mr. Douglas a post in his cabient as secretary of the Interior in 1946. He offered him the vice presidential spot on his ticket in 1948. There was an abortive effort to secure the Democratic presidential nomination for Mr. Douglas in 1948 and another in 1952.

Mr. Douglas dismissed suggestions that he seek political office, maintaining that his carreer was on the court. And on the court he maintained a certain distance from his colleagues. He took little part in efforts to forge majorities on given questions. Rather, he saw it as his constitutional duty to write on cases as he saw them, regardless of the temper of the times or even of whether he would persuade other justices to adopt his views.

"The Constitution was designed to keep government off the backs of the people," Mr. Douglas wrote in 1972 in dissenting from a ruling in which the court refused to stop the Army from maintaining surveillance over private individuals. He also believed, in the words of Vern Countryman, a former Douglas law clerk and now a professor at Harvard Law School, "that government has an obligation to keep private power off the backs of the people and to maintain those conditions of living -- environmental, social, political, and economic -- that make individual living worthwhile."

In the application of these principles, Mr. Douglas often took the side of criminal defendants, the poor, women, Communists, political dissidents, children, homosexuals and others who he felt the law had slighted. He was uncompromising in his support of civil rights. He supported labor unions until he felt that their power had grown to the point of impinging on individual rights. He supported corporations when he felt the government had gone too far in controlling them.

Like his friend and frequent ally, Associate Justice Hugo L. Black, Mr. Douglas yielded to no one in his defense of the "firstness" of the First Amendment. He believed that it meant that the government could not curtail any speech whatsoever, no matter how inflammatory, insulting or libelous it might be.

His own language was blunt and colorful. In a 1969 opinion in an obscenity case, he said he opposed censorship "not because, as frequently charged, I relish 'obscenity.' I think the First Amendment bars all kinds of censorship."

For all of his championship of individual rights, Mr. Douglas felt equally strongly that individuals must give way to the general welfare where the quality of life was at stake. Thus, in his opinion in the landmark urban renewal case of Berman v. Parker in 1954 he upheld the land-use powers of the District of Columbia not only to clear slums, but also to condemn valuable property for use in a comprehensive, communitywide scheme of living.

This concern for the general welfare was the rationale for a 1973 opinion in which he sustained a village ordinance that was hostile to "hippies" and others with unconventional lifestyles.

Like Black and associate justices Olive Wendell Holmes Jr. and Louis D. Brandeis in an earlier day, Mr. Dogulas was a great dissenter. He lived to see many of his dissents become the law of the land as the court, under Chief Justice Earl Warren, adopted views that he had urged unsuccessfully earlier. They included legislative reapportionment, curtailment of police powers, and the right of all criminal defendents to free counsel if they could not afford attorneys of their own.

Always he sought to expand the frontiers of the law and to stimulate debate on what it should be. In an effort to measure the social, political and economic impact of the court's work, he used a far broader range of disciplines than had been the custom. To this extent he had an influence on the basis on which cases are decided, not only by the Supreme Court, but by lower courts.

Opinions flew from his pen. Some of his work was criticized by lawyers who said that it lacked the precision necessary to deal with such matters as business regulations and taxation. A second criticism of Mr. Douglas was that his refusal to bargain with his colleagues -- except through the abstract and aloof medium of the printed page -- diluted his effectiveness on the court.

It left him free, however, to write some opinions that have a luminosity and eloquence rare in state documents. An example is his dissent in the 1950 case of Dennis v. the United States.

The defendents were the 12 leaders of the Communist Party of the United States. They were charged under the Smith Act with conspiring to advocate the overthrow of the government by the use of force. Their convictions were affirmed by a federal appeals court and the case went to the Supreme Court on the theory that the Smith Act violated the First Amendment's protection of free speech.

The Cold War was at its height. Members of the court could not help but be aware of pressures to affirm the convictions. By a vote of six to two (Associate Justice Tom Clark, a former attorney general, removed himself from consideration of the case), they did so. The two dissenters were Mr. Douglas and Black. Of these, only Mr. Douglas wrote an extended opinion.

The majority had argued that the conspiracy of which the Communists had been convicted constituted a "clear and present danger" to the government in the context of the Cold War. The "clear and present danger" formula had been devised by Justice Holmes in a line of sedition cases following World War I.

In his dissent, Mr. Douglas supported the "clear and present danger" concept, but argued that the majority had misapplied it because the Communists merely had spoken about their aims and taken no other action to attain them. He added:

"Free speech has occupied an exalted position because of the high service it has given our society. Its protection is essential to the very existence of a democracy. The airing of ideas releases pressures which otherwise might become destructive. When ideas compete in the market for acceptance, full and free discussion exposes the false and they gain few adherents. Full and free discussion even of ideas we hate encourages the testing of our own prejudices and preconceptions. Full and free discussion keeps a society from becoming stagnant and unprepared for the stresses and strains that work to tear all civilizations apart."

In 1969, the court reversed a state conviction of a Ku Klux Klan leader who had said that unless the government stopped oppressing whites, "it's possible there might to some revengeance (sic) taken." In its opinion, the court adopted the position taken by Mr. Douglas in the Dennis case: Speech must be accompanied by action.

But Mr. Douglas, who was perhaps more receptive to new ideas than any of the justices who sat with him, had changed his earlier views.

"I see no place in the regime of the First Amendment for any 'clear and present danger' test," he wrote in concurring with the majority. "When one reads the opinions closely and sees where and how the 'clear and present danger' test has been applied, great misgivings are aroused. First, the threats were often loud but always puny and made serious only by judges so wedded to the status quo that critical analysis made them nervous. Second, the test was so twisted and preverted in Dennis as to make the trial of the teachers of Marxism an all-out political trial which was part and parcel of the cold war that has eroded substantial parts of the First Amendment."

Mr. Douglas' independence led him in 1953 to one of his most controversial actions. He stayed the executions of Julius and Ethel Rosenberg, who had been convicted of conspiring to steal atomic secrets for the Russians in one of the most publicized cases of that time. The court, which had just recessed for the summer, immediately reconvened and orderer the executions to proceed. Mr. Douglas dissented.

This prompted Rep. William M. Wheeler (D-Ga.) to introduce a resolution calling for Mr. Douglas' impeachment. Nothing came of it.

Twenty years later, Mr. Douglas ordered the government to stop the bombing of Cambodia. The full court consulted by telephone and immediately overruled him.

By then, Mr. Douglas had survived a second and more serious effort to impeach him. It was launched by Gerald R. Ford, who then was the House Minority Leader, and it had the backing of President Richard M. Nixon. Mr Douglas had been considering resigning. The new threat persuaded him to stay.

The occasion was the refusal of the Senate to comfirm Nixon's successive nominations to the Supreme Court of Clement F. Haynsworth Jr. and G. Harold Carswell. The rebuffs unleashed the wrath of the White House on the court's most liberal member. An 18-count impeachment resolution was introduced that accused Mr. Douglas of maintaining links with organized crime and included such other charges as advocating revolution and having his work appear in "pornographic" magazines.

But the heart of the charges was Mr. Douglas' service as president of the Parvin Foundation, which allegedly received part of its income from Las Vegas gambling interests. Mr. Douglas received $12,000 a year for his work on the foundation, whose other members included Robert Maynard Hutchins, a former president of the University of Chicago, and Robert Goheen, the president of Princeton University.

The Parvin Foundation was established by Albert B. Parvin, a Los Angeles businessman who held a mortgage on the Flamingo Hotel in Las Vegas. He had read "America Challenged," a book Mr. Douglas published in 1960 that called for increased cultural exchanges among the peoples of the world as a way of maintaining peace. Parvin wrote Mr. Douglas to say that he would endow a foundation to promote these ends and asked Mr. Douglas to head it.

Mr. Douglas did so until 1969, when he resigned. None of the foundation's income came from gambling.

In 1970, a special subcommittee of the House Judiciary Committee published a 900-page report that absolved him of all impeachment charges.

That Mr. Douglas faced two attempts at impeachment in the course of his career was only one of the many contradictions of his life. Not the least of them was his development on the court. When he left the bench he was foremost advocate of personal freedom. When he joined it, he was know chiefly as a brilliant student, teacher and theorist of the law of corporate finance.

Hard as he worked on the court, the end of each term would find him at his retreat at Goose Prairie, Wash., out of reach of his fellow justices as they rushed to finish the court's business and therefore out of their favor. He was the only member of the Supreme Court ever to have written about undergoing psychoanalysis. Yet he was an intensely private man who rarely held press conferences. Although his earnings off the bench were estimated to exceed $500,000, he scorned wealth.

Away from the court, he was an internationalist who called repeatedly for disarmament and increased help for the Third World. He published a score of books. Many of them advocated his belief that exposure to the American example would persuade other peoples to embrace democratic principles better than any show of force.

As a conservationist, Mr. Douglas' activities were as direct as his opinions were blunt. In 1954, The Washington Post published an editorial proposing that the Chesapeake & Ohio Canal between Washington and Cumberland, Md., be used as the right-of-way for a highway. Mr. Douglas challenged the newspaper's editors to walk the 185-mile length of it with him and then make up their minds about what ought to be done with it. Some editors did so, and The Post changed its position. The canal was made part of the National Park system in 1971 and 1977 it was dedicated to Mr. Douglas by act of Congress.

Contradictions apart, Mr. Douglas embodied many of the nation's most cherished ideals. He overcame an improverished childhood to make good. He overcome poor health to climb mountains. He came out of the Far West, learned the law, and brought the giants of Wall Street to heel.

He was born on Oct. 16, 1898, in Maine, Minn., a small town near the North Dakota border. His father, William, was a Presbyterian minister and his first permanent parish was in Maine. The town also was the birthplace of Mr. Douglas' mother, the former Julia Bickford Fiske.

The elder Douglas moved his family to California and later to Cleveland, Wash., in an effort to improve his failing health. The boy himself was stricken with polio at the age of three. When he was six, his father died. Mrs. Douglas moved her family -- there was another boy, Andrew, and a girl, Martha -- to Yakima, Wash. That is where the future justice grew up and it was to nearby Goose Prairie that he so often returned.

Young Douglas' childhood was hard. The family was poor. He overcame the effects of his polio through a program of exercise. It was an experience that profoundly affected his outlook. Among other things, it helped form the special feeling he had for the outdoors.

Mr. Douglas served as a private in the Army during World War I, won a scholarship to Whitman College in Walla Walla and graduated with honors in 1920. He then returned to Yakima and taught school, trying to save money for law school. It was during this period that he met Mildred M. Riddle, a fellow teacher. They were married in 1923.

That did not interrupt Mr. Douglas' plans to attend law school. He set out for New York with $75 in his pocket and a determination to attend Columbia Law School. He worked on stock cars, handling sheep, to save the cost of a ticket for part of the journey. He also consorted with hoboes. When he arrived in New York, he had 6 cents to his name. He managed to borrow money for food.

Although he said in his autobiography, "Go East, Young Man," that "ideas were not congenial in Yakima," he hated New York. Years later, he argued in a dissenting opinion that a businessman should have been allowed to deduct an expense-free trip to New York from his taxes because going there was "a chore," and that those who did so "sacrificed valuable time that might better have been spent on the farm, in the woods, or along the seashore."

But he did well at Columbia, graduating near the top of his class and nearly being appointed a clerk by then Associate Justice Harlan Fiske Stone. Instead, he went to work for a New York law firm and there he got his introduction to the law of corporate finance. Shortly thereafter, he began teaching the subject at Columbia Law School. In 1929, he moved to the Yale law school, were he stayed until 1934.

It was at Yale that Mr. Douglas formed two of the lasting friendships of his life. They were with Abe Fortas, who later served with him on the Supreme Court, and Thurman Arnold, a founder of the Washington law firm of Arnold & Porter.

By 1934, Mr. Douglas was an authority on the law of bankruptcy. He moved to Washington and joined the newly founded Securities and Exchange Commission. Joseph P. Kennedy, its first chairman, put him to work on frauds growing out of corporate reorganizations. In 1936, President Roosevelt appointed him an SEC commissioner and he became a member of the inner circle of the New Deal and one of FDR's poker companions. In 1937, he succeeded Kennedy as SEC chairman.

In 1939, he became Roosevelt's fourth appointment to the Supreme Court, taking the seat vacated by Justice Brandeis.

The court recently had been the object of Roosevelt's famous attempt to "pack" its membership so that it would cease to declare unconstitutional the many programs he put into effect to fight the Great Depression. Roosevelt's effort failed, but the court began to give broader readings to the clause in the Constitution allowing Congress to "regulate commerce . . . among the several States."

Although some feared -- and others hoped -- that Mr. Douglas would prove to be a friend of Wall Street, he joined in decisions upholding New Deal measures to regulate the economy.

These decisions marked the most significant contributions of the Supreme Court during the late 1930s and through the 1940s. Left for the 50s and the years beyond were the great questions of civil rights and civil liberties. It was in these areas that Mr. Douglas made his most indelible mark.

In addition to his notable opinions in behalf of free speech and civil rights, he expanded the definition of privacy to include the invalidation of a state law prohibiting the dissemination of birth control information and devices to married persons. For constitutional authority, he found that "specific guarantees in the Bill of Rights have penumbras, formed by emanations from those guarantees, that help give them life and substance. . . . Various guarantees create zones of privacy."

In 1973, he wrote a concurring opinion when the court struck down a state law limiting abortions. The groundwork for that decision had been laid by Mr. Douglas in the earlier birth-control decision.

By then Mr. Douglas was nearing the end of his career. After 1969, when Warren E. Burger succeeded Earl Warren as cheif justice, Mr. Douglas found himself increasingly in the minority again. However, he continued to fulfill his role as a kind of internal policeman of the court by threatening to publish dissents if actions of which he profoundly disapproved were taken.

In 1968, a pacemaker was implanted in Mr. Douglas to regulate his heartbeat. On New York's Eve, 1974, he suffered a stroke. He made repeated efforts to return to the court, although he was partially paralyzed and confined to a wheelchair.On Nov. 12, 1975, he wrote to President Ford, saying that he was resigning because "incessant and demanding pain" had made it impossible for him to "shoulder my full share of the burden."

Mr. Douglas' first marriage, by which he had two children, Mildred (now Mrs. Norman T. Read, of Cornwall, England) and William Orville Jr. (now of Wilsonville, Ore.), ended in divorce in 1953. A year and a half later, he married Mercedes Hester Davidson, who was 18 years younger than he. They were divorced in 1963.

In the same year, Mr. Douglas married Joan Martin, then a 23-year-old government worker. They were divorced on June 24, 1966. Three weeks later, he married Cathleen Curran Heffernan, who was 23 and working as as waitress to put herself through college when they met. She is now an attorney in Washington. The marriage lasted until Mr. Douglas' death. A sister, Martha Bost, of Los Angeles, also survives, as do six grandchildren.

The justice's colleagues paid him emotional tributes when his retirement was announced by Chief Justice Burger. Mr. Douglas responded with a letter addressed to "My Dear Brethern."

"I am reminded of many canoe trips I have taken in my lifetime," he wrote. "Those who start down a water course may be strangers at the beginning but almost invariably are close friends at the end . . . The greatest journey I've made has been with you, my brethren, who were strangers at the start but warm and fast friends at the end . . ."

The resignation notwithstanding, Mr. Douglas found it difficult to stay away. Although he had always been among the most jealous guardians of the prerogatives of the court and its members, he tried to serve as the "tenth" justice on one case even after John Paul Stevens had been appointed to replace him. It was not permitted. Mr. Douglas' great journey on the Supreme Court had ended.