Allen Weinstein stands in his office at the National Archives with a painting of one of his heroes, President Franklin D. Roosevelt. (Bill O'Leary/The Washington Post)

Allen Weinstein, a historian who wrote a provocative book about accused Cold War spy Alger Hiss, was an early Western advocate for Russian leader Boris Yeltsin, and served as the ninth archivist of the United States, died June 18 at a nursing home in Gaithersburg, Md. He was 77.

The cause was pneumonia, said his son Andrew Weinstein.

Dr. Weinstein served from 2005 until 2008 as chief of the National Archives and Records Administration — the institution that preserves the Declaration of Independence, the Constitution and the Bill of Rights, as well as billions of documents, photographs, maps and other materials accumulated in more than two centuries of American history.

He had previously established himself as an academic, with professorships at Smith College in Northampton, Mass., Georgetown University and Boston University. Outside academia, he held leadership roles at nonprofit institutions — most notably the Center for Democracy in Washington, which he founded in the mid-1980s and led as president until 2003.

In that capacity, he became, as the Los Angeles Times once described him, the “advance team in America” for Yeltsin, the Russian reformist leader. When hard-liners attempted a coup against Soviet President Mikhail Gorbachev in 1991, Yeltsin and his camp used Dr. Weinstein as an intermediary in the United States, sending him faxes and other notifications of the news.

“It is military coup,” read the first. “Tanks are everywhere.”

As a pro-democracy activist, columnist David Ignatius of The Washington Post once wrote, Dr. Weinstein was “probably the dean of the new overt operatives” who aided Soviet dissidents, helped establish representative governments in Eastern Europe as the Soviet Union disintegrated and conducted election-monitoring in countries including the Philippines, Panama and Nicaragua.

As an author, Dr. Weinstein was most noted for his book “Perjury: The Hiss-Chambers Case” (1978). The volume delved into one of the enduring mysteries of the Cold War, in which Whittaker Chambers, a journalist and former Soviet agent, accused State Department official Alger Hiss of having once been a Soviet spy.

Hiss insisted on his innocence but was convicted of perjury in 1950 and imprisoned for 44 months. The case propelled the career of another Hiss accuser — future president Richard M. Nixon, then a young California congressman.

In his research, Dr. Weinstein obtained 30,000 pages of FBI and Justice Department records, interviewed Soviet spies and received cooperation from Hiss. The author professed that he had set out thinking Hiss was innocent but was ultimately persuaded of his guilt.

“We may expect that newer and perhaps more ingenious defenses of Hiss may emerge, if only because none of the many theories raised during the past six decades has proved persuasive,” Dr. Weinstein wrote in a later edition of the book. “There has yet to appear, however, from any source, a coherent body of evidence that seriously undermines the credibility of the evidence against Alger Hiss.”

Hiss, who died in 1996 at 92, dismissed Dr. Weinstein’s charges as “terribly thin stuff and childish.” Critics led by Victor S. Navasky, the editor of the Nation magazine, charged that Dr. Weinstein had misquoted some sources. Other historians complained that Dr. Weinstein had declined to make his research materials fully available for review, a violation of professional standards.

In other circles, however, the book was acclaimed as a triumph. Columnist George F. Will wrote in Newsweek that it was a “historical event” — “stunningly meticulous, and a monument to the intellectual ideal of truth stalked to its hiding place.”

“The myth of Hiss’s innocence,” Will wrote, “suffers the death of a thousand cuts, delicate destruction by a scholar’s scalpel.”

In later years, Dr. Weinstein drew notice for “The Haunted Wood: Soviet Espionage in America — The Stalin Era” (1999), a volume he co-authored with former KGB officer Alexander Vassiliev. Their publisher, Random House, paid a reported $100,000 to retired KGB operatives for exclusive access to records, an un­or­tho­dox decision in the academic environment.

Commentator Jacob Heilbrunn later defended the authors, writing in the Los Angeles Times that while “pious indignation is touching,” Dr. Weinstein and Vassiliev “had zero chance of obtaining the documents unless they complied with the Russian foreign service intelligence archive’s onerous restrictions on access.”

Dr. Weinstein’s academic background prompted some controversy when President George W. Bush nominated him as archivist. Some critics suggested that Bush might have wished to install an archivist who would limit access to the presidential papers of his father, George H.W. Bush, which were due to be released.

“I am not in anybody’s pocket,” Dr. Weinstein told the New York Times, “and I am committed to maximum access.” He was a registered Democrat but had supported President Ronald Reagan, a Republican, and described himself politically as a “raving moderate.”

As archivist, he ended secret agreements with the CIA and the Air Force by which thousands of declassified documents had been removed from public view. “We’re in the access business,” Dr. Weinstein said, “not the classification business,’’

He also was credited with helping lead the transition of Nixon’s presidential library from a private institution into a federal one. Dr. Weinstein resigned in 2008 as he struggled with Parkinson’s disease.

Allen Weinstein, the son of Jewish immigrants from Eastern Europe, was born in New York City on Sept. 1, 1937. He received a bachelor’s degree in history from the City College of New York in 1960 and a master’s degree in 1962 and PhD in 1967, both from Yale University and both in history.

Dr. Weinstein worked briefly on The Post’s editorial staff in 1981. He held leadership positions with the National Endowment for Democracy, the U.S. Institute of Peace and the Center for the Study of Democratic Institutions in Santa Barbara, Calif.

His marriage to Diane Gilbert Sypolt ended in divorce. Survivors include his wife of 20 years, Adrienne Dominguez of Bethesda, Md.; two sons from his marriage to Sypolt, Andrew Weinstein of Washington and David Weinstein of Rockville Centre, N.Y.; a stepson, Alex Content of Wheaton, Md.; and three grandchildren.