It’s been 18 years since 9/11, and for families and friends of the nearly 3,000 people killed that day, seeing the mastermind of the terror plot brought to justice has been a frustratingly elusive commodity.

But this anniversary of the worst attack on US soil brings with it the promise that Khalid Sheikh Mohammed, the admitted architect of the Sept. 11 attacks, is finally scheduled for trial before a military tribunal — which could sentence him and several al Qaeda cronies to death.

Mohammed, or KSM as he is better known, was al Qaeda leader Osama bin Laden’s operational planner and came up with the idea of using hijacked planes as missiles against America.

He will finally face trial on 2,976 counts of murder and related charges before a military tribunal at Guantanamo Bay, Cuba, on Jan. 11, 2021.

Even though it will be nearly 20 years since the coordinated crashing of passenger planes into the Twin Towers and the Pentagon, with a fourth forced down in a Pennsylvania field after passengers tried to storm the cockpit and wrest back control from its hijackers, the prosecution shouldn’t be hampered, said one noted terror lawyer.

“I think they’re relying on what I understand to be extensive confessions and other evidence that you see in terrorist cases: text messages, emails and organizations taking credit,” said attorney Steve Zissou.

Law professor Victor Hansen, a retired lieutenant colonel in the US Army’s Judge Advocate General Corps, said he expected that prosecutors would “focus on as many overwhelming facts as they can establish to link these five suspects with 9/11.”

“I think the prosecution will try to relive the events of 9/11 in as much detail as possible, and remind the panel sitting in judgment of the horrific event,” said Hansen, who teaches at New England Law school in Boston.

But the passage of time could also help KSM and co-defendants Walid bin Attash, Ramzi Bin al-Shibh, Ammar al-Baluchi and Mustafa Ahmed al-Hawsawi if their eventual jury of seven military officers has to decide the question of capital punishment.

Debra Burlingame, whose brother, pilot Charles “Chic” Burlingame III, was killed when American Airlines Flight 77 smashed into the Pentagon, said another brother had been picked by prosecutors to testify at a potential penalty phase.

But Bradley Burlingame died of pancreatic cancer in 2015 at age 63.

“That was a crushing loss for my family, that he didn’t live to see our brother’s murderers brought to justice,” Burlingame said by phone Tuesday while traveling to Wednesday’s memorial service at the Pentagon.

Even if KSM somehow manages to miraculously score an acquittal, there’s no way he’ll ever escape his cell in Guantanamo Bay, according to Zissou, who represented a former Gitmo detainee in the deadly 1998 bombings of two American embassies in Africa.

Zissou said the Sept. 11-inspired Patriot Act gives President Trump — or any successor — “extraordinary power to hold people deemed enemy combatants indefinitely.”

“No president of the United States is ever going to let him go,” Zissou said.

Following his capture in Pakistan in March 2003, KSM spilled his guts at a secret, overseas CIA “black site” where he was waterboarded 183 times and subjected to other “enhanced interrogation” techniques.

He admitted committing multiple horrors, including personally decapitating Wall Street Journal reporter Daniel Pearl on video and organizing the 1993 bombing of the World Trade Center, another bombing at a nightclub in Bali, Indonesia, and “shoe bomber” Richard Reid’s failed attempt to blow up a passenger plane over the Atlantic Ocean.

“I was responsible for the 9/11 operation, from A to Z,” he said.

None of that evidence can be used against him, however.

But prosecutors say KSM and his co-defendants also gave legal confessions to the FBI after being transferred to the US military base at Guantanamo Bay.

Defense lawyers contend that the CIA and FBI teams worked hand in glove, and are challenging the admissibility of the Gitmo confessions at pretrial hearings that are expected to run through March 2020.

Three weeks of hearings before the trial judge, Air Force Col. W. Shane Cohen, began Monday, when KSM got a new lead defense lawyer, Gary Sowards, who formerly represented “Unabomber” Theodore Kaczynski, The New York Times reported.

Another lawyer who joined his team was ACLU lawyer Denny LeBouef, who the Times said has been meeting with him since 2013 as director of the ACLU’s John Adams Project, which assists in the defense of Gitmo detainees charged with capital crimes.

The John Adams Project came under scrutiny in 2009 over allegations it hired researchers who took photographs of CIA officials that were shown to Gitmo detainees, The Washington Post reported at the time.

Retired FDNY Deputy Chief Jim Riches, who attended three days of pretrial hearings in 2008 that were interrupted by a short-lived plan to transfer the case to Manhattan federal court, said he doubted the trial would get underway as planned.

“Those guys are playing a game down there,” he said of the defendants, who he watched from behind a glass partition.

“They laughed, they stood up, they prayed whenever they wanted. Total disrespect … I wanted go in and punch them out.”

Richard Miniter, author of the 2011 book “Mastermind: The Many Faces of the 9/11 Architect, Khalid Shaikh Mohammed,” recounted an even more outrageous incident in which KSM “wrote down the four flight numbers from 9/11, folded it into a paper airplane and floated it toward where the family members were watching.”

“It was a giant FU to the families,” he said.

Miniter said he expected KSM — who he called a “very smart, evil man” — to eventually fire his lawyers and represent himself so he can turn his trial into an international spectacle.

“He told the Arabic press that he considers the legal system in Guantanamo to be a second jihad. This is just fighting by different means,” Miniter said.

But Miniter said high-level military sources told him it was unlikely KSM would get the death penalty, noting that the military hasn’t executed anyone since 1961.

“If this was ancient Rome, they would have dragged him into Yankee Stadium and stoned him to death with the rubble of the World Trade Center — but those days are gone,” he said.