President-elect Donald Trump agreed Friday to pay $25 million to settle class-action lawsuits that accused the now-defunct Trump University of defrauding students.

Trump apparently will admit no wrongdoing in ending lawsuits brought in New York and California. Still, the decision is a turnaround for the Republican, who had vowed to fight the claims to the end.

“Today’s $25 million settlement agreement is a stunning reversal by Donald Trump and major victory for the over 6,000 victims of his fraudulent university,” said New York Attorney General Eric Schneiderman, who filed one of the lawsuits against Trump in 2013.

Under the terms, Trump will pay restitution to every student in the lawsuit and up to $1 million in penalties to the state of New York for violating state education laws, said Schneiderman, who battled publicly with the Republican over the last three years.

“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.

Trump representatives didn’t immediately respond to a request for comment.

advertisement | advertise on newsday

Testimony had been set to begin in the cases on Nov. 28 in a federal court in San Diego — presided over by U.S. District Judge Gonzalo Curiel, the jurist Trump claimed was prejudicial because of his Mexican heritage (even though Curiel was born in Indiana).

Despite Trump’s attacks, Curiel had encouraged setttlement talks, saying days after the election it would be “wise” to “resolve this case given all else that’s involved.”

Back in February, Trump tweeted about the case: “I could have settled, but won’t out of principle!” Later at a campaign event, Trump reportedly said: “Probably should have settled it, but I just can’t do that. Mentally I can’t do it. I’d rather spend a lot more money and fight it.”

Schneiderman “has long said” he was open to a “a settlement that fairly compensates the many victims of Trump University who have been waiting years for a resolution,” Schneiderman spokesman Eric Soufer said in an email.

Former students at Trump University accuse Trump and his school of using misleading advertising to dupe 5,000 individuals — 800 of them New Yorkers — to pay up to $35,000 for seminars and mentorships through the unlicensed, unaccredited business he called a university. Trump has said most students were satisfied and contended the lawsuits were politically motivated.

Schneiderman previously said Trump “is absolutely shameless” about lying to people to “induce them to his seminars,” which cost upward of $20,000. He said the playbook was a guideline to “dupe” people into paying for more courses. He initially sought about $40 million for the students.

Trump, in response, had called Schneiderman “dopey” and said he would win the various lawsuits against Trump University.