LOS ANGELES (AP) — Ailing 95-year-old media mogul Sumner Redstone has settled a series of lawsuits pitting him against his ex-girlfriend days before a trial was set to begin.

Redstone’s attorney, Robert Klieger, said Tuesday that Manuela Herzer will return $3.25 million that Redstone had given her and relinquish any claim she has over his estate or health.

The settlement agreement says it ends seven lawsuits and countersuits between Redstone and Herzer that began in 2015 after their breakup and involve his estate, allegations of elder abuse and invasion of privacy.

Sumner, the majority shareholder of CBS and Viacom, said he had given Herzer tens of millions of dollars.

The legal fight had largely centered on whether Redstone, who has been in mental decline, was able to testify and make decisions for himself.