A judge on Friday approved an agreement reached with President Trump to pay $25 million to settle three lawsuits filed against him over Trump University real estate seminars,

US District Judge Gonzalo Curiel in San Diego had been expected to sign off on the agreement, which was reached last year, ending nearly seven years of legal wrangling between Trump and former students of his real estate university who claimed they were ripped off.

Hundreds of plaintiffs claimed they were pressured to spend thousands on “worthless gimmickry," and filed two cases in California and one in New York.

“Today's final approval by a judge of our Trump University settlement will provide relief – and hopefully much-needed closure – to the victims of Donald Trump's fraudulent university," New York Attorney General Eric T. Schneiderman said in a statement. "Trump University's victims waited years for compensation, while President Trump refused to settle and fought us every step of the way - until his stunning reversal last fall."

In November, the then-president-elect tweeted he had decided to settle the lawsuits to "focus on our country."

Trump's camp also said they were certain they would have prevailed in court.

"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," a spokesperson for the Trump organization said.

The settlement was reached as one of the cases was set to begin the trial Nov. 28 in San Diego, more than six years after it was filed, and represents a complete reversal for Trump, who vowed as a candidate to fight the lawsuits in court.

Curiel had been urging attorneys to meet in a last-ditch effort to reach a settlement before trial. Citing the election, Curiel — who was accused of being biased by Trump because of his Mexican heritage despite actually being born in Indiana — also said the president could have been forced to testify via video should the case go to trial.

Bebeto Matthews / AP

There had been negotiations in the past, but they were for only modest amounts, according to a source. Serious settlement talks began in earnest, however, after Trump was elected president.

In the New York complaint, Schneiderman described Trump University as “nothing more than a classic bait and switch scheme where Donald Trump promised students real estate secrets, but gave them little more than a mountain of debt."

Under the terms of the settlement, Schneiderman said every plaintiff will receive restitution and Trump will pay up to $1 million in penalties to the state of New York for violating state education laws.

"This case has been unprecedented in so many ways," Jason Forge, a San Diego-based attorney for the plaintiffs, told BuzzFeed News after the settlement was announced. "It’s only fitting that it end with an unprecedented recovery for so many people."

Attorneys for the plaintiffs also announced that despite years of legal work they decided to not take any legal fees out of the settlement. Class memberswill receive a minimum of 55% of their damages, with the possibility ofrecouping the full value of their claims.