President-elect Donald Trump agreed to pay $25 million to settle claims that his defunct Trump University cheated more than 6,000 students with false promises of teaching them his real estate secrets.

The accord, announced Friday minutes before the start of a court hearing in San Diego, resolves two class-action lawsuits in California by former students, as well as a fraud case filed in 2013 by New York’s attorney general.

In cutting the deal after years of fighting the allegations, Trump avoids a potentially distracting trial that was set to start in 10 days as he’s consumed by his transition, including selecting appointees for his administration.

The judge, whom Trump attacked during the campaign as being biased against him because of his Mexican heritage, had urged Trump and the former students to settle the case to avert what would have been the first trial in U.S. history to feature testimony from a president-elect.

“While we have no doubt that Trump University would have prevailed at trial based on the merits of this case, resolution of these matters allows President-elect Trump to devote his full attention to the important issues facing our great nation,” Alan Garten, general counsel of the Trump Organization, said in a statement.

Trump, 70, was accused of conning thousands of students, including many senior citizens, into paying as much as $35,000 for real-estate seminars by falsely telling them they’d be taught by his handpicked instructors at an accredited university.

Students Approved

Trump has repeatedly denied the fraud allegations and has cited Trump University’s 98 percent approval rating as evidence the program was providing valuable instruction.

U.S. District Judge Gonzalo Curiel in San Diego was set to consider Trump’s request to postpone the Nov. 28 trial until after his inauguration. After confirming the settlement, the judge said a schedule needed to be set to allow former students to review and accept, reject or drop out of the agreement. He ordered the settlement to be filed by Dec. 19. Ex-students who don’t participate in the settlement could still bring individual claims.

The lawsuit was brought on behalf of former students from California, Florida and New York. A separate case in which a nationwide group of ex-students accuse Trump of racketeering, also before Curiel, hadn’t been scheduled for trial.

New York Attorney General Eric Schneiderman, a Democrat, claimed students lost as much as $40 million and that Trump may have personally made as much as $5 million from the school. The Republican Trump responded at one point by calling Schneiderman a hack.

‘Phony University’

Get the latest on global politics in your inbox, every day.

Get our newsletter daily.

“Donald Trump fought us every step of the way, filing baseless charges and fruitless appeals​ and refusing to settle for even modest amounts of compensation for the victims of his phony university,” Schneiderman said in a statement. “Today, that all changes. Today’s $25 million settlement agreement is a stunning reversal by Donald Trump and a major victory for the over 6,000 victims of his fraudulent university.”

Attorneys in the case said the settlement allocates $21 million for ex-students nationwide and $4 million for New York victims who weren’t part of the class-action cases. It wasn’t disclosed how the money would be divided among the former students, who paid from $1,500 for a three-day seminar to as much as $35,000 for the “Trump Gold Program.”

Since the proposed settlement is on behalf of former Trump University students who aren’t individually represented in the case, Curiel will have to make sure it’s fair to them and negotiated in good faith. In most class-action settlements, the judge weighs objections from members of the class before giving final approval.

Lawyers for the students agreed to forgo legal fees as part of the settlement.

‘Real Money’

“This allows us to maximize the recovery for the victims,” Jason Forge, one of the attorneys representing the victims, told the judge. “Both sides spent a lot of effort to ensure that the victims get real money back.”

Daniel Petrocelli, a lawyer for Trump, told the judge that Trump and the other defendants aren’t acknowledging any wrongdoing by settling. He also praised Curiel.

“We really appreciated your hard work in working through this case and this litigation,” Petrocelli said. “This is a big part in allowing president-elect Trump to move forward as president."

Earlier this week, Trump dropped his lawsuit against Palm Beach County in which he objected to commercial air traffic over his Mar-a-Lago estate in Florida. Trump has sued Palm Beach County and its airport three times claiming that flights over the resort, his part-time home, were unnecessarily noisy. In the two prior suits, he has dropped the claims before they went to trial.

‘Enormous Result’

In the Trump University case, Douglas F. Gansler, a Democrat and Maryland’s former attorney general, called $25 million “an enormous result.”

“Trump University can jump up and down all they want and say they did nothing wrong, but companies don’t give $25 million in a settlement if they haven’t done something,” said Gansler, who isn’t involved in the case. “New York should be happy with the result."

The New York case is The People of the State of New York v. Trump Entrepreneur Initiative LLC, 451463/2013, New York State Supreme Court (Manhattan). The California case is Low v. Trump University LLC, 10-00940, U.S. District Court, Southern District of California (San Diego).