Two victims of the CIA’s torture program have reached a historic legal settlement with the contract psychologists who designed and helped implement it. The U.S. government has never publicly compensated any of the men tortured in CIA custody, and this legal settlement — the terms of which are confidential — is the first of its kind.

Under former presidents George W. Bush and Barack Obama, the Justice Department repeatedly moved to block lawsuits at their early stages, arguing that court cases about government torture in clandestine prisons would reveal state secrets. In 2015, however, the American Civil Liberties Union filed suit against James Mitchell and Bruce Jessen, the two psychologists the CIA paid to create torture techniques.

The lawsuit argued that those techniques were later used on the plaintiffs in the case — Suleiman Abdullah Salim and Mohamed Ben Soud, who had been tortured in CIA custody before being released without charges, as well as the family of a third man, Gul Rahman, who was tortured to death in U.S. custody in 2002.

After overcoming multiple government attempts to dismiss the case, the suit was set to go to trial Sept. 5. Today, the ACLU announced the last-minute settlement. Because the settlement mandates confidentiality, lawyers for the ACLU declined to discuss the terms with The Intercept.

“Every previous case involving the CIA torture program was shut down before it even began,” said Dror Ladin, an ACLU attorney. “But our clients prevailed over three separate attempts to dismiss their claims, were able to force top CIA officials to answer questions under oath, and secured a first-of-its-kind settlement.”

Ben Soud told the New York Times: “I feel that justice has been served. Our goal from the beginning was justice and for the people to know what happened in this black hole that was run by the C.I.A.’s offices.”

As part of the settlement, the plaintiffs and defendants released a joint statement admitting that Salim and Ben Soud were subject to “coercive methods,” and that Mitchell and Jessen had “contemplated the use of specific coercive methods to interrogate certain detainees.” In the statement, Mitchell and Jessen maintain that they had no direct knowledge or involvement in the plaintiffs’ interrogations.

As the case had progressed, Mitchell and Jessen maintained that they were not the architects of the program, and that they were merely following government orders. In a bizarre legal defense, the psychologists’ lawyers compared their clients to the contractors who supplied the Nazis with Zyklon B, the poison gas used to murder millions of Jews and others during the Holocaust.

Senate investigators found that Mitchell and Jessen were intimately involved in the program’s formation, and even personally waterboarded Abu Zubaydah, the first detainee in CIA custody. Investigators also found that the psychologists later formed their own company to consult with the CIA, which was paid $81 million before the program was shut down in 2009.

In an opinion to deny a motion of summary judgment last week, Judge Justin Quackenbush dismissed Mitchell and Jessen’s claim that they were not the creators. “It is not credible to argue Defendants were paid $80 million for suggesting some techniques the Air Force … already knew about,” Quackenbush said. “It is also undisputed that defendants did not merely suggest [‘enhanced interrogation techniques’], they actually applied EITs to Zubaydah, interrogated Rahman, and participated in the program for several years.”

According to the original lawsuit, Salim and Ben Soud were both subjected to beatings, starvation, stress positions, confinement in coffin-like boxes, and various forms of water torture. Both had suffered lasting physical and psychological damage. In November 2002, Rahman was stripped naked, beaten, immersed in cold water, and put in an isolation cell overnight, where he died from hypothermia.

Although the government was not a defendant in the case, Mitchell and Jessen likely had access to CIA coffers to cover their legal fees. In 2013, Senate investigators found that Mitchell and Jessen had signed a multimillion-dollar indemnification contract with the CIA, saying that the government would foot their legal bills through 2021 if they were ever sued or prosecuted.

After Obama shut down the CIA’s torture program in 2009, his administration was widely criticized by human rights groups, who argued that the administration’s failure to prosecute officials involved in the program opened the door for future administrations to ignore the law and practice torture again.