Nearly three years after the Weinstein Co. declared bankruptcy, a judge on Monday confirmed a liquidation plan that provides a $17.1 million fund for Weinstein’s sexual misconduct victims.

The plan also provides $9.7 million to the former officers and directors of the Weinstein Co., allowing them to pay a portion of their legal bills over the last several years. The directors and officers — who include Weinstein’s brother, Bob, as well as James Dolan, Tarak Ben Ammar and Lance Maerov — also received releases that absolve them of any potential liability for enabling Weinstein’s conduct.

U.S. Bankruptcy Judge Mary Walrath approved the plan after a hearing in Delaware, saying that without the settlement, Weinstein’s victims would get “minimal, if any, recovery.”

The liquidation plan wraps up a contentious and long-running legal fight over the remnants of Weinstein’s independent studio. The company collapsed in late 2017, following the disclosure of dozens of allegations of rape, sexual assault, harassment and other misconduct.

Several insurance carriers will pay out a total of $35.2 million to resolve all the remaining claims, including those from the Weinstein Co.’s trade creditors.

The $17 million victims’ fund will be divided among more than 50 claimants, with the most serious allegations resulting in payouts of $500,000 or more. The settlement was put to a vote of Weinstein’s victims, with 39 voting in favor and eight opposed.

Ruby Liu, an attorney representing the objectors, argued Monday that the settlement fund is “meager” and that the deal deprives her clients of the opportunity to pursue Bob Weinstein and other directors in court.

“There are more than monetary considerations that my clients are seeking,” she said. “They are seeking a finding from a jury that holds all responsible parties accountable. That’s not just Harvey Weinstein.”

Paul Zumbro, an attorney representing the Weinstein Co. estate, argued that the deal was the best one obtainable for the victims. Without releasing the directors and officers, the insurance companies would not have been willing to pay out.

Several attorneys who supported the plan argued it is better to give the majority of the claimants “closure,” rather than forcing all the claimants to endure years of litigation for an uncertain outcome.

“This is the best we’re going to do,” said Debra Grassgreen, an attorney for the unsecured creditors committee.

An earlier version of the settlement would have provided a $24.3 million payout to victims, including women who alleged they were abused in the “Miramax” era, which predated 2005. But Judge Alvin Hellerstein rejected the deal, saying the class action suit that included the Miramax-era victims was not viable. The settlement was later revised to exclude Miramax, Disney and their insurers.

A portion of the defense cost payout was initially earmarked for Harvey Weinstein’s defense. That funding was stripped out of the plan. The civil claimants still have the option to pursue Harvey Weinstein in civil court, though most of the attorneys involved believe he has few assets that could be recovered.

The bulk of the Weinstein’s Co.’s assets were sold in 2018 to Lantern Capital, a Dallas-based private equity firm, for $289 million. Those funds were used to pay the company’s secured creditors.