U.S. Bankruptcy Judge Raymond Ray approved a final liquidation plan Thursday for Ponzi schemer Scott Rothstein’s defunct law firm, clearing the way for the distribution of $80 million to investors by Labor Day.

The ruling by the Fort Lauderdale judge ends nearly four years of messy and expensive litigation that involved nearly every top bankruptcy lawyer in South Florida.

The end came after a marathon two-day settlement conference between TD Bank and lawyers for several groups of investors, who filed a rival liquidation plan and threatened to scuttle the plan proposed by trustee Herbert Stettin for the 70-attorney Rothstein Rosenfeldt Adler.

Ray also approved about $30 million in fees for Stettin’s legal and accounting team, with the lion’s share going to Berger Singerman and Genovese Joblove & Battista.

After the standing-room only hearing, dozens of attorneys crossed the aisle to shake hands and hug each other. Many of the attorneys planned a celebratory lunch.

“It’s been a long haul,” said a weary-looking Paul Singerman of Berger Singerman, who represented the bankruptcy trustee. “I’m planning on celebrating by getting some sleep.”

The hearing was scheduled for two days following months of discovery, depositions and witness preparation in a case with 5,000 docket entries. However, Michael Goldberg of Akerman Senterfitt, who represented the creditors’ committee, brokered the settlement between TD Bank and attorneys for the Beverly, Marlin and Razorback investors.

Investor attorneys at Conrad & Scherer and Kozyak, Tropin & Throckmorton opposed the trustee’s liquidation plan due to a provision for a bar order protecting TD Bank, Scott Rothstein’s primary bank in his $1.2 billion settlement financing fraud, from most third-party litigation. The bank was chastised by a federal judge in a investor case for aiding and abetting the fraud.

The same attorneys have other cases pending against TD Bank on behalf of investors and victims of the Ponzi scheme. They also have requests for sanctions and punitive damage pending against the bank in a state court case.

The settlement reached late Wednesday allows the attorneys to pursue sanctions against the bank as a carve-out from the bar order. It also calls for TD Bank to pay Scherer’s clients $54 million, including $29 million within two business days.

“I feel great,” he said. “We still have one round to go in state court. We have a fraud case the bankruptcy court couldn’t take.”

Scherer declined to reveal his attorney fees in the $54 settlement, saying: “That’s my business. It’s between me and my clients.”

After reaching the settlement, Scherer and his team withdrew their rival liquidation plan filed three days ago.

While federal prosecutors list Rothstein’s fraud as a $1.2 billion failure, Charles Lichtman, a partner at Berger Singerman, said the amount that flowed through the scheme was arguably higher. No one has offered a reliable number for the loss suffered by investors and law firm clients and vendors.

The case generated $461 million in claims, which were trimmed to $120 million after the removal of duplicate and inflated claims and clawback negotiations. The total recovery amounts to about $196 million, including $40 million in attorney and accounting fees approved by Ray, Lichtman said.

About $113 million is in the bank from settlements and recovered Rothstein property, he said.

The only remaining objection to the fees came from Steven Schneiderman of the U.S. trustee’s office, who said he wanted a chance to see the attorneys’ redacted timesheets.

“Here comes Steven Schneiderman to ruin our day,” Ray said as the courtroom erupted in laughter.

“My job is to raise the issue,” responded Schneiderman.

“And my job is to decide it,” Ray fired back.

Another moment of levity came when Singerman offered to outline his contributions to the case as part of his fee request.

“It’s not necessary. I’ve been here as long as you have,” Ray interrupted. “The results speak for themselves.”

He approved the fees.

Approval of the liquidation plan puts an end to one chapter of the Rothstein saga. However, the criminal side is unfinished.

Rothstein is serving a 50-year prison sentence for masterminding one of the largest Ponzi schemes in Florida history from his law firm.

Quipped Goldberg after the hearing, “Scott Rothstein produced way more legal work from his Ponzi scheme than he did in 25 years of practicing law.”