Senior US officials failed to tell the truth about the war in Afghanistan throughout the 18-year campaign — and hid evidence that it was unwinnable, according to a damning report by the Washington Post.

The paper, which obtained a cache of government documents under the Freedom of Information Act after a three-year legal battle, reported that the American officials made repeatedly lied about the longest armed conflict in US history.

The trove includes over 2,000 pages of previously unpublished notes of interviews with people who played a direct role in the war during the Bush, Obama and Trump administrations, including generals, diplomats, aid workers and Afghan officials, according to the Washington Post.

The paper referred to its reporting as The Afghanistan Papers — a reference to The Pentagon Papers, the top-secret Defense Department study of American military involvement in Vietnam from 1945 to 1967, which was published by the New York Times and the Washington Post in 1971.

In the case of Afghanistan, hundreds of insiders offered blunt criticism of how the US became mired in almost two decades of warfare, offering a mix of pent-up grievances, frustrations and confessions, as well as second-guessing and backbiting.

“We were devoid of a fundamental understanding of Afghanistan — we didn’t know what we were doing,” Douglas Lute, a three-star Army general who was the White House’s Afghan war czar during the Bush and Obama administrations, told government interviewers in 2015.

“What are we trying to do here? We didn’t have the foggiest notion of what we were undertaking,” Lute added, according to the report.

“If the American people knew the magnitude of this dysfunction … 2,400 lives lost,” he said as he blamed the deaths of American troops on bureaucratic breakdowns among Congress, the Pentagon and the State Department.

“Who will say this was in vain?” he added.

Since 2001, more than 775,000 American service members have deployed to Afghanistan. Of those, 2,300 were killed and 20,589 were wounded in action, according to the Defense Department.

US officials acknowledged in the interviews that their military strategies were fatally flawed and that Washington wasted huge amounts of money trying to remake Afghanistan into a modern nation.

They also shed light on the US government’s failed attempts to curtail runaway corruption, build a functional Afghan army and police force, and control Afghanistan’s lucrative opium trade.

Thought the costs incurred in the war in Afghanistan are staggering, the US government has not carried out a comprehensive accounting of how much it has spent, the report said.

The Defense Department, State Department and US Agency for International Development have spent or allocated between $934 billion and $978 billion, according to an inflation-adjusted estimate from Neta Crawford, co-director of the Costs of War Project at Brown University.

“What did we get for this $1 trillion effort? Was it worth $1 trillion?” Jeffrey Eggers, a retired Navy SEAL and White House staffer for Bush and Obama, told interviewers.

“After the killing of Osama bin Laden, I said that Osama was probably laughing in his watery grave considering how much we have spent on Afghanistan,” he added.

The documents also contradict the longstanding narrative from US presidents, military commanders and diplomats who assured the public that they were making progress in Afghanistan and that the war was worth fighting.

Several of the interviewees described efforts by government and military officials to deliberately mislead the public, distorting statistics to make it appear the US was winning the war when it was not.

“Every data point was altered to present the best picture possible,” Bob Crowley, a US Army colonel who served as a senior counterinsurgency adviser in 2013 and 2014, told the government interviewers.

“Surveys, for instance, were totally unreliable but reinforced that everything we were doing was right and we became a self-licking ice cream cone,” he said.

John Sopko, head of the Office of the Special Inspector General for Afghanistan Reconstruction, which conducted the interviews, told the newspaper that the documents demonstrate “the American people have constantly been lied to” on Afghanistan.

The agency, known as SIGAR, was created by Congress in 2008 to investigate waste and fraud in the war zone.

In 2014, SIGAR conducted more than 600 interviews for an initiative titled “Lessons Learned,” an $11 million project that was meant to diagnose policy failures in Afghanistan so the US would not repeat the errors the next time it invaded a country.

Most of the interviewees were Americans, but SIGAR officials also traveled to London, Brussels and Berlin to interview NATO allies. They also interviewed about 20 Afghan officials, discussing reconstruction and development programs in the country.

The Washington Post said it had to sue SIGAR twice in federal court to forces it to release the documents.

The agency eventually disclosed more than 2,000 pages of unpublished notes and transcripts from 428 of the interviews, in addition to several audio recordings.

The documents identify 62 of the interviewees, but SIGAR blacked out the names of 366 others, arguing that those people should be seen as whistleblowers and informants whose identities should be protected.

Sopko, the inspector general, told the paper that he did not suppress the scathing criticisms and doubts about the war that officials mentioned in the interviews.

He said it took his office three years to release the materials because he has a small staff and because other federal agencies had to review the documents to prevent government secrets from being released.

“We didn’t sit on it,” he insisted. “We’re firm believers in openness and transparency, but we’ve got to follow the law. … I think of any inspector general, I’ve probably been the most forthcoming on information.”