William P. Rogers, 87, who served Republican presidents as attorney general and secretary of state and capped a public career that spanned five decades by leading the investigation of the Challenger space shuttle disaster in 1986, died of congestive heart failure Jan. 2 at Suburban Hospital.

Mr. Rogers, a former assistant prosecutor in New York and a Navy veteran of World War II, had been the chief counsel of a Senate investigating committee, a delegate to the U.N. General Assembly in 1965 and a member of an ad hoc U.N. committee on Southwest Africa. A senior member of the Washington-New York legal establishment, he was a partner in the law firm of Rogers & Wells, which a year ago became Clifford Chance Rogers & Wells.

In the 1960s, Mr. Rogers argued successfully before the U.S. Supreme Court in two leading cases on libel law and the First Amendment, New York Times v. Sullivan and The Associated Press v. Walker.

In 1973, he received the Medal of Freedom, the nation's highest civilian honor.

Mr. Rogers served President Dwight D. Eisenhower as deputy attorney general from 1953 to 1957 and as attorney general from 1957 to 1961. From 1969 to 1973, he was secretary of state under President Richard M. Nixon. His tenure at the State Department was marked by a ferocious and losing struggle with Henry M. Kissinger, then Nixon's national security adviser, for control of foreign policy.

When the Challenger blew up during takeoff on Jan. 29, 1986, killing all seven astronauts aboard, President Ronald Reagan appointed Mr. Rogers the head of a commission to find out what had happened.

In the panel's first working session, Mr. Rogers realized that management failures at the National Aeronautics and Space Administration were a principal part of the problem. To ensure the commission's objectivity, he barred from the investigation all NASA officials who had had a part in the launch decision. As he said in an interview, "We changed from a review body to a working-level investigating body."

The tragedy was traced to a failed O-ring seal. In its report, the commission called the disaster an "an accident rooted in history" and concluded, "The NASA shuttle program had no focal point for flight safety."

The report was considered a model of its kind and led to extensive changes in the space exploration program.

In his years at the Justice Department, Mr. Rogers engaged in such matters as the selection of federal judges, the protection of civil rights and the welfare of Hungarian refugees arriving in the United States after the anti-communist uprising in 1956. As the country's top law enforcement officer, he launched an anti-crime campaign, and he pursued an aggressive antitrust policy, bringing suits against such companies as General Motors and Westinghouse. He was a frequent administration spokesman on Capitol Hill.

Some of his greatest contributions were in the field of civil rights. He was involved in the crisis in Little Rock in 1957, when Eisenhower sent the Army to enforce federal court orders integrating Central High School, and he played an important role in the passage of the Civil Rights Act of 1957, which guaranteed the right to vote. He established the Civil Rights Division in the Justice Department and made it one of the most dynamic parts of the government.

Nixon chose Mr. Rogers to be secretary of state because he wanted to keep foreign policy in his own and Kissinger's hands. Mr. Rogers had almost no experience in foreign affairs, but Nixon valued him for his loyalty. The two had been friends since first coming to Washington in the late 1940s, Nixon as a freshman Republican congressman from California and Mr. Rogers as a Senate committee aide.

Mr. Rogers had encouraged Nixon to pursue Alger Hiss, a former State Department official who had become president of the Carnegie Endowment for International Peace. In dramatic testimony in 1948, Whittaker Chambers, a former communist and espionage agent, said Hiss had spied for Moscow during his State Department years.

Hiss denied it, and many rallied to his cause. President Harry S. Truman dismissed the charges as a red herring, and Secretary of State Dean Acheson declared famously, "I will not turn my back on Alger Hiss."

Nixon, an obscure newcomer to Washington, was up against enormously powerful forces. But Mr. Rogers urged him to proceed because he believed Chambers had information that could not have been made up. This advice was vindicated by events. In 1950, after two years of investigations, charges and denials, Hiss was convicted of perjury and sentenced to prison. The episode was a landmark of the early Cold War years, and it made Nixon's national reputation. Nixon went on to win election to the Senate in 1950.

In the 1952 election campaign, when the existence of a secret political fund almost forced Nixon to resign as Eisenhower's vice presidential running mate, Mr. Rogers helped him write the "Checkers" speech that saved his candidacy.

On Sept. 24, 1955, when Eisenhower had a heart attack, Nixon turned to Mr. Rogers. Desperate to avoid the news media, Nixon slipped out of his house in the Wesley Heights section of Northwest Washington and spent the night in the Rogers home in Bethesda. Meanwhile, Nixon's wife, Pat, served coffee to reporters camped out at the Nixon home.

When Eisenhower had a stroke in 1957, Mr. Rogers again was at Nixon's side.

In the 1960s, when Nixon and Mr. Rogers were practicing law in New York, they remained close, although there was competition between them for clients.

It was with those things in mind that Nixon chose Mr. Rogers to be secretary of state. In his memoirs, he wrote, "I knew that I could trust him to work with me on the most sensitive assignments in domestic as well as foreign policy."

Nixon also called Mr. Rogers a "strong administrator" who could manage "the reluctant bureaucracy of the State Department." Given Mr. Rogers's ability to get along with Congress, Nixon also hoped he would be able to halt "the almost institutionalized enmity" that had grown up between the White House and the Senate Foreign Relations Committee under Sen. J. William Fulbright (D-Ark.), a leading critic of U.S. involvement in Vietnam.

In "The White House Years," his memoir of the period, Kissinger quoted Nixon as saying: "Rogers was one of the toughest, most cold-eyed, self-centered, and ambitious men he had ever met. As a negotiator he would give the Soviets fits. And 'the little boys in the State Department' had better be careful because Rogers would brook no nonsense."

Kissinger added: "Few secretaries of state can have been selected because of their President's confidence in their ignorance of foreign policy."

Mr. Rogers summarized his own view of the United States and its place in the world in these terms: "I reject the chessboard theory that we lose countries or gain them. What I favor for the U.S. is a more natural role, befitting our character and capacities. Unless we are ready to risk war or intrude recklessly in others' affairs, we must recognize that some problems are beyond our capacity to solve."

In the councils of the Nixon administration, he often urged restraint. He opposed the bombing of communist sanctuaries in Cambodia in 1969, for example, and he favored a quick end to the war in Southeast Asia. When North Korea shot down a Navy spy plane with 31 people aboard, Mr. Rogers joined Defense Secretary Melvin R. Laird in successfully opposing plans to bomb a North Korean airfield in retaliation.

But because Nixon was determined to keep all the threads of foreign policy in his and Kissinger's hands, the secretary of state was kept in the dark about many of the administration's most important initiatives and was not always supported in his own initiatives.

In 1969, Mr. Rogers was not told that Nixon had been in contact with Ho Chi Minh until 48 hours before the president revealed it on television.

Again in 1969, when the secretary proposed a formula for peace for Israel and its neighbors, the White House promptly spread the word that "the Rogers Plan" was aptly named -- that it was the secretary's idea, not the administration's. Similarly, after Mr. Rogers and Soviet Ambassador Anatoly Dobrynin had their first substantive meeting on Vietnam, the president had Kissinger tell Dobrynin the secretary had gone beyond Nixon's position.

In 1971, Mr. Rogers was not kept informed of White House-Kremlin talks that led to a breakthrough on strategic arms limitations. He learned of Nixon's historic opening to Communist China that year only when Kissinger was on his way to Beijing to clear the way for Nixon's own visit.

Mr. Rogers and Kissinger attempted to hold regular meetings to coordinate their work, but soon gave it up.

"Rogers was too proud, I intellectually too arrogant," Kissinger wrote in "The White House Years." "And we were both too insecure to adopt a course which would have saved us much unneeded anguish."

Disputes between the two men were frequent. Mr. Rogers refused to carry out directives with which he disagreed unless he got orders from Nixon in person. Nixon, who hated face-to-face disagreement, preferred to deal in memos. On the theory that the memos actually had been written by Kissinger, the secretary ignored them even when they bore Nixon's signature.

For his part, Kissinger was furious that Mr. Rogers still had direct access to the Oval Office and often was Nixon's dinner guest in his private quarters at the White House, a favor the national security adviser never received.

As details leaked out, the rivalry was widely discussed in the press, with Mr. Rogers receiving much criticism for not protecting the State Department's turf. Sen. Stuart Symington (Mo.), a prominent Democrat, referred to him as "the laughingstock of the cocktail circuit."

However, Kissinger later wrote: "Rogers was in fact far abler than he was pictured; he had a shrewd analytical mind and outstanding common sense. But his perspective was tactical; as a lawyer he was trained to deal with issues as they arose 'on their merits.' My approach was strategic and geopolitical; I attempted to relate events to each other, to create incentives or pressures in one part of the world to influence events in another.

"Rogers was keenly attuned to requirements of particular negotiations. I wanted to accumulate nuances for a long-range strategy. Rogers was concerned with immediate reaction in the Congress and media, which was to some extent his responsibility as principal spokesman in foreign affairs. I was more worried about results some years down the road."

In his memoirs, Nixon said: "Since I valued both men for their different views and qualities, I tried to keep out of the personal fireworks that usually accompanied anything in which they both were involved.

"Rogers felt that Kissinger was Machiavellian, deceitful, egotistical, arrogant, and insulting. Kissinger felt that Rogers was vain, uninformed, unable to keep a secret, and hopelessly dominated by the State Department bureaucracy. . . . Kissinger suggested repeatedly that he might have to resign unless Rogers was restrained or replaced."

In "Nixon in Winter," published four years after the former president's death in 1994, Monica Crowley quoted Nixon as making what amounted to an apology to his old friend.

"I'll tell you right now -- the way I treated Rogers was terrible," Nixon said. "I had Kissinger, and he and I kept so many things from Rogers, and that was inexcusable. I used Kissinger when I should have been using my secretary of state, and we had our reasons, but it wasn't right. I didn't even tell Rogers about the China thing until it was a done deal. I regret that because Rogers was smart and a good man."

William Pierce Rogers was born in Norfolk, N.Y., on June 23, 1913. His father was Harrison A. Rogers, a bank director and paper mill executive. His mother was Myra Beswick Rogers. He attended Colgate University on a scholarship, graduating in 1934. He received his law degree in 1937 from Cornell University, where he was an editor of Cornell Law Quarterly and a member of the Order of the Coif.

In 1938, after a brief stint with a Wall Street law firm, he was hired by Thomas E. Dewey, the future New York governor, as an assistant district attorney for Dewey's campaign against the gangsters of Murder Inc. He was one of 60 lawyers out of 6,000 applicants who were hired. Over the next four years, he handled 1,000 cases.

During World War II, Mr. Rogers served in the Navy and saw action aboard an aircraft carrier at Okinawa.

After the war, he returned to the district attorney's office, but soon moved to Washington to join the staff of the Senate War Investigating Committee, which became the Senate Permanent Investigating Committee. He was chief counsel from 1947 to 1950. The committee exposed "five-percenters" who fixed federal contracts for private firms.

In 1950, Mr. Rogers went to New York and became a partner of Dwight, Royall, Harris, Koegel & Caskey, a forerunner of Clifford Chance Rogers & Wells. He joined the firm after the Eisenhower administration and again after his years at the State Department. In the 1960s, his clients included The Washington Post Co.

Mr. Rogers, a tall, affable figure, had a reputation for being practical and unflappable. Friends said he had both a sense of humor and a temper. Although he spent much of his career at or near the center of events, he was essentially a private person. After leaving government, he rarely gave interviews. Asked once if he ever intended to write a book, he replied: "I don't like to live in the past. You have to stop everything to write an authoritative book. And besides, it's hard to write interestingly without being critical of people."

Mr. Rogers held honorary degrees from Duquesne University, Loyola University, Columbia University, St. Lawrence University, Washington-Jefferson University, Middlebury College, Clarkson College and Colgate University.

He lived in Bethesda. He was a member of the Metropolitan, Burning Tree and Chevy Chase clubs in the Washington area and the Recess, Racquet and Tennis and Sky clubs in New York.

Survivors include his wife, the former Adele Langston, whom he married in 1937, of Bethesda; a daughter, Dale Rogers Marshall of Norton, Mass.; three sons, Douglas, of Columbus, Ohio, Jeffrey, of Portland, Ore., and Anthony, of Newton, Mass.; 11 grandchildren; and four great-grandchildren.

William P. Rogers at the White House with President Richard M. Nixon in 1971. Mr. Rogers, an early political ally, was Nixon's first secretary of state.