Matthew M. Aid, a onetime intelligence analyst and researcher who drew on his “obsession” with the National Security Agency in writing a history of the secretive intelligence organization and also revealed that once-public documents at the National Archives were quietly being reclassified and taken off the shelves, died Aug. 20 at his home in Washington. He was 60.

The cause was heart disease, said his brother, Jonathan Aid.

Mr. Aid began delving into military and intelligence matters in his early teens, then became a Russian-language expert in the Air Force before he was court-martialed in the 1980s for possessing classified information and impersonating an officer. He spent a year in a military jail and received a discharge for bad conduct — a fact revealed in 2006 and, in Mr. Aid’s words, “my worst nightmare.”

Close acquaintances said he worked for a time as an NSA analyst and spent at least 15 years as a researcher for global investigative organizations, including Investigative Group International and Kroll. Among other things, he examined records of companies involved in hostile takeovers and looked into emerging businesses in Russia.

By his own admission, however, Mr. Aid’s primary occupation was as an independent scholar who spent most of his time digging through documents at libraries and, especially, at the National Archives in College Park, Md.

“I have no idea how to take a normal vacation,” he told The Washington Post in 2006. “Any spare time I have, I run up to the National Archives to do historical research.”

Mr. Aid was particularly interested in the NSA, the country’s largest intelligence organization, which is based at Fort Meade, Md. He spent years working on a history of the agency, filing hundreds of Freedom of Information Act requests, before publishing his study, “The Secret Sentry,” in 2009.

Notable deaths in 2018 and 2019: Nipsey Hussle, George H.W. Bush, Stan Lee, John McCain, Aretha Franklin and other famous faces we’ve lost

Nipsey Hussle, a Grammy nominated rapper who sought to revive South Los Angeles, died at age 33 on March 31. Read the obituary (Matt Winkelmeyer/Getty Images for Warner Music)

He traced the agency’s history to its founding in 1952 and earlier, uncovering many examples where the NSA failed in its mission. It was slow to recognize the full scale of China’s involvement in the Korean War, did not detect Soviet missiles on Cuban soil in the early 1960s and missed many developments during the Vietnam War.

One of Mr. Aid’s most significant findings, which became publicly known in 2005, was an NSA coverup of erroneous records related to the 1964 Gulf of Tonkin incident, in which U.S. officials alleged that North Vietnamese torpedo boats twice fired on U.S. Navy ships. The incident led to U.S. military engagement in Vietnam.

A report written by an agency historian in 2001 noted that U.S. intelligence officers falsified documents about a disputed attack, but the report was suppressed.

“To keep it classified simply because it might embarrass the agency is wrong,” Mr. Aid told the New York Times in 2005. “Rather than come clean about their mistake, they helped launch the United States into a bloody war that would last for 10 years.”

In 2006, after searching in vain for documents he had previously reviewed, Mr. Aid discovered a previously unknown effort to remove public records from the National Archives. He believed various intelligence agencies, including the CIA and defense intelligence agencies, were attempting to conceal awkward or revealing episodes from public view.

“I like things neat,” Mr. Aid told The Post in 2006. “And when I started getting the runaround from people at the Archives about why this stuff wasn’t available, that’s when I started getting angry . . . They would not give me an explanation. Alarm bells started going off when that happened.”

Archives officials later revealed that more than 25,000 records had been removed and vowed to stop the practice. Many of the newly classified documents were decades old and seemed to be part of an effort to hide U.S. intelligence blunders of the past.

Timothy Naftali, then a University of Virginia history professor, said Mr. Aid had performed “a great service” in exposing the reclassification program.

“His work helps all of us fight against the culture of secrecy in Washington today,” Naftali said. “We don’t have enough watchdogs.”

Matthew Morris Aid was born March 11, 1958, in New York City. His mother was a political activist, and his father was a lawyer for Mobil Oil. The family lived in France and Libya for several years during Mr. Aid’s youth.

When Mr. Aid was 12, his brother said, he would tell his parents in New York that he was going to the library — only the library was at the National Archives. He took the train to Washington, then returned home in time for dinner.

Mr. Aid graduated in 1980 from Beloit College in Wisconsin, where he studied international relations. He joined the Air Force, took Russian language training but was court-martialed when found to be in possession of top-secret information.

“I had the proper clearance for it, so it’s not as if I stole anything,” he told The Post. “Basically, being a workaholic, I took stuff home with me.”

He was also charged with impersonating an officer — an attempt to impress a young woman, he said. He was held in custody for a year before being given a bad-conduct release in 1985.

Survivors include his brother and parents, Harry and Rita Aid, all of Washington.

In 2012, Mr. Aid published “Intel Wars: The Secret History of the Fight Against Terror,” about the role of intelligence agencies in the post-9/11 world. He was writing another book about the NSA at the time of his death.

“Sometimes the services didn’t like what he wrote,” Cees Wiebes, a Dutch intelligence analyst and scholar who worked with Mr. Aid said in an interview. “But they respected him because he was right.”

An earlier version of this story incorrectly reported that Matthew M. Aid was a staff researcher for the 9/11 Commission. The commission’s executive director, Philip D. Zelikow, said Mr. Aid was not a member of the staff.