SAN FRANCISCO:-The struggle for the control of US media giant Viacom appeared to be over after an agreement Friday with the last member of the majority-shareholding family still challenging a deal reached last week. A spokesman for nonagenarian media mogul Sumner Redstone and his daughter Shari said that an agreement had reached with the final holdout - Keryn Redstone, the billionaire's 34 year-old granddaughter. The court battle for control of Viacom - which owns Paramount Pictures, MTV, Nickelodeon, and Comedy Central - has dragged on for months.

Viacom announced a formal agreement on August 20 under which Sumner Redstone, 93, will remain atop his empire and chief executive Philippe Dauman leave the company and drop all lawsuits against Redstone and his daughter Shari.

Viacom's management, led by Dauman, had alleged in court that Shari Redstone effectively controls her ailing father and was making a power grab for his $40 billion media empire. Sumner Redstone, a Hollywood legend whose fortune is estimated at $5 billion, is also the majority shareholder in the CBS media group.

However Keryn Redstone - a beneficiary of a trust set up years ago by Sumner Redstone to leave shares to his grandchildren - was not part of that deal, and threatened to sue alleging that her grandfather was being manipulated.

A Massachusetts judge on Friday got the parties to reach an agreement on the trust management, and to allow Keryn Redstone to visit her grandfather, who she says she has been banned from seeing since February.

"I filed this lawsuit to protect my grandfather, to assure that his wishes were carried out, and to prevent Shari's handpicked new trustees from discriminating against me in administering the trust and making distributions - something that my grandfather would never have tolerated when he was healthy," Keryn Redstone said in a statement issued by her lawyer.

"I am heartened that we have been able to force that the trust be amended to make it ironclad and bullet proof that this will not happen," she said.

All claims filed by Keryn Redstone against Sumner and Shari Redstone "have been dismissed, the settlement agreement is firmly in place, and Sumner's decisions have been honored in all respects," an attorney for Shari Redstone said.