Shari Redstone is well on her way to declaring victory in the battle over the future of the $40 billion media empire controlled by her father, Sumner M. Redstone.

It sure didn’t look that way about a year ago, when she had been restricted from visiting his Los Angeles mansion, where he lived with his then-girlfriend and another former lover. At that point, Mr. Redstone’s longtime confidant and Ms. Redstone’s longtime rival, Philippe P. Dauman, was still at his side.

Hanging in the balance was the future of her family’s fortunes, as well as the fate of two of the world’s largest entertainment companies, CBS and Viacom. Through National Amusements, the Redstone family controls about 80 percent of the voting stock in CBS and Viacom.

In fairly swift order, the girlfriends were pushed out of the picture and Ms. Redstone reconciled with her father. Then came the reordering of the boards of National Amusements and Viacom that led to the dismissal of Mr. Dauman as chief executive of Viacom, which had struggled mightily.

Now, the father-daughter duo are calling for CBS and Viacom to reunite in an all-stock transaction that would leave them firmly in control of the conglomerate.

The battle has been caustic and personal. It included legal fights in three states centering on the question of whether or not Mr. Redstone, who is 93 and in poor health, had the mental capacity to make decisions about his businesses. At several points, Ms. Redstone’s opponents painted her as a villain who manipulated her father. The attacks took their toll; Ms. Redstone hated the drama and had trouble sleeping in the midst of the battle, according to two people close to her who spoke on condition of anonymity to discuss personal matters.

Today, Ms. Redstone is settling in to the new landscape. She doesn’t want to personally lead CBS or Viacom, the people close to her say, and ultimately, she is seeking to return to her life out of the spotlight, where she is most comfortable.

The word to describe the relationship between Ms. Redstone and her father is complicated. Over the years, the two feuded publicly over her role in his companies and sometimes communicated solely via fax, if at all. In private, he was known to denigrate her in conversations with other executives. Things became so bad that Ms. Redstone had been restricted from visiting his home and was largely left out of the inner workings of his companies.

That changed last fall when, in quick succession, the two women thought to exert influence over Mr. Redstone — Mr. Redstone’s then-girlfriend Sydney Holland and his former companion Manuela Herzer — were exiled from his home. Soon after, Ms. Redstone reunited with her father. They celebrated the holidays together, often communicated via FaceTime and visited with his two small great-grandchildren.

In effect, Ms. Redstone reclaimed her role as the doting daughter and successor to Mr. Redstone’s business empire.

Prevailing Over Manuela Herzer

The first legal challenge came the day before Thanksgiving last year, when Ms. Herzer filed suit challenging the mental competence of Mr. Redstone and asserting that she had been improperly removed from a directive that would have given her authority over his health decisions. The lawsuit was filled with embarrassing details about Mr. Redstone’s feeble condition and sexual desires. Ms. Redstone also became a target in the dispute, with Ms. Herzer asserting that she used a network of spies to influence her father.

The Redstones emerged victorious in the legal challenge in May, when a California judge abruptly dismissed the suit after just one day of testimony. The judge was swayed by the videotaped testimony shown during the proceedings, in which Mr. Redstone said he did not want Ms. Herzer in charge of his care or in his life at all. When Mr. Redstone was asked who he wanted to handle his health care decisions if he was unable to do so himself, he replied: “Shari” — establishing publicly and in a legal setting that his daughter was his aide-de-camp.

The episode put Ms. Redstone on firmer footing to move ahead with the sweeping business changes to be made in the next several months.

Reordering the Boards

Strengthened by the legal victory over Ms. Herzer and aided by a new team of lawyers and public relations strategists, Ms. Redstone moved on to the corporate fight.

Mr. Redstone became an active executive after largely remaining in the background since 2014. His name and voice were added to directives and statements that dismissed two of his longtime business partners and confidants from the National Amusements board and the trust that will control his companies after he dies.

Soon after, National Amusements moved to reorder Viacom’s board, a precursor to overhauling the struggling company’s executive team.

The ousted National Amusements directors, Mr. Dauman and George S. Abrams, promptly filed suit, challenging Mr. Redstone’s competence and asserting that he had been manipulated by Ms. Redstone. Viacom’s lead independent director also sued, seeking to block the changes to the Viacom board.

The two sides fought it out in vicious legal battles in three states during the course of the summer.

Ousting Philippe Dauman

Ms. Redstone’s distaste for Mr. Dauman was public: She was the sole Viacom director to cast a vote against elevating Mr. Dauman to chairman of the company when her father vacated the post in February.

Ms. Redstone put the blame, in large part, on Mr. Dauman for Viacom’s sagging fortunes and did not believe he was the one to revive the company. Viacom’s share price had plunged nearly 50 percent during the last two years of Mr. Dauman’s tenure.

The feud also was personal, with Mr. Dauman long considered the son Mr. Redstone wished he had.

Step by step, Mr. Dauman was stripped of his authority and pushed into a corner where his only recourse was to wage a series of expensive, messy legal battles. First, Mr. Dauman was removed from his seats positions on the board and trust of National Amusements. Then, he faced the prospect of a new board of directors aligned with Ms. Redstone.

Mr. Dauman finally threw in the towel in August, agreeing to a settlement that called for his dismissal, albeit with a $72 million parachute.

In the fight for control of the Redstone empire, Shari Redstone was the clear winner.

Pushing to Reunite CBS and Viacom

With Mr. Dauman out and a new Viacom board in, Ms. Redstone and her father are now pressing forward with their preferred plan: a reuniting of CBS and Viacom that would leave them in control of the conglomerate. The father-daughter duo sent a thinly veiled letter to the board of each company last week, making clear that this is the path the Redstones prefer and probably will get.

Special committees of the boards of both companies are considering a deal; the Viacom committee is largely made up of the new directors who are known allies of Ms. Redstone.

A version of this article appears in print on , on Page B2 of the New York edition with the headline: Villain to Doting Daughter: How Shari Redstone Turned the Tide. Order Reprints | Today’s Paper | Subscribe