WASHINGTON — Then-President Donald Trump laid the groundwork to try to overturn the 2020 election even before he lost, knowingly pushed false claims of voter fraud and “resorted to crimes” in his failed bid to cling to power, according to a newly unsealed court filing from prosecutors that lays out fresh details from the landmark criminal case against the former president.

The filing from special counsel Jack Smith’s team offers the most comprehensive view to date of what prosecutors intend to prove if the case charging Trump with conspiring to overturn the election reaches trial.

Though a monthslong congressional investigation and the indictment itself have chronicled in detail Trump’s efforts to undo the election, the new filing cites previously unknown accounts offered by Trump’s closest aides to paint a portrait of an “increasingly desperate” president who while losing his grip on the White House “used deceit to target every stage of the electoral process.”

“So what?” the filing quotes Trump as telling an aide after being alerted that his vice president, Mike Pence, was in potential danger after violent supporters stormed the U.S. Capitol on Jan. 6, 2021.

“The details don’t matter,” Trump said, when told by an adviser that a lawyer who was mounting his legal challenges wouldn’t be able to prove the false allegations in court, the filing states.

The brief was made public over the Trump legal team’s objections in the final month of a closely contested presidential race in which Democrats have sought to make Trump’s refusal to accept the election results four years ago central to their claims that he is unfit for office.

The issue surfaced as recently as Wednesday’s vice presidential debate when Gov. Tim Walz, a Democrat, recounted the violence on Jan. 6 while Republican opponent, Sen. JD Vance, refused to directly answer when asked if Trump had lost the 2020 race.

The filing was submitted, initially under seal, last week following a Supreme Court opinion that conferred broad immunity on former presidents for official acts taken in office, narrowing the scope of the prosecution charging Trump with conspiring to overturn the vote lost to President-elect Joe Biden, a Democrat.

The purpose of the 165-page brief is to convince U.S. District Judge Tanya Chutkan that the offenses charged in the indictment are private acts, not official, and can therefore remain part of the indictment.

Chutkan permitted a redacted version to be made public Wednesday.

“Although the defendant was the incumbent President during the charged conspiracies, his scheme was fundamentally a private one,” Smith’s team wrote, adding, “When the defendant lost the 2020 presidential election, he resorted to crimes to try to stay in office.”

Trump campaign spokesman Steven Cheung called the brief “falsehood-ridden” and “unconstitutional.”

The filing includes details of conversations between Trump and Pence, including a private lunch Nov. 12, 2020, in which Pence “reiterated a face-saving option” for Trump, telling him, “don’t concede but recognize the process is over,” according to prosecutors.

In another private lunch days later, Pence urged Trump to accept the results and run again in 2024.

“I don’t know, 2024 is so far off,” Trump told him, according to the filing.

But Trump “disregarded” Pence “in the same way he disregarded dozens of court decisions that unanimously rejected his and his allies’ legal claims, and that he disregarded officials in the targeted states — including those in his own party — who stated publicly that he had lost and that his specific fraud allegations were false,” prosecutors wrote.

Trump’s “steady stream of disinformation” in the weeks after the election culminated in his speech at the Ellipse on the morning of Jan. 6, 2021, in which Trump “used these lies to inflame and motivate the large and angry crowd of his supporters to march to the Capitol and disrupt the certification proceeding,” prosecutors wrote.

Still, despite its narrow legal purpose, the expansive brief, filed in Federal District Court in Washington, also served as something like a trial brief, setting forth Smith’s fullest exposition yet of what he has learned in his nearly two-year-long investigation of Trump.

The filing was accompanied by a lengthy sealed appendix of many of the fruits of that inquiry — FBI interviews, search warrant affidavits and grand jury testimony — some of which could also soon be revealed to the public.

The New York Times contributed.