When CBS filed suit to strip Shari E. Redstone of her voting control of the company in May, no one purported to be more surprised — and hurt — than Ms. Redstone herself.

Perhaps she shouldn’t have been.

Ms. Redstone, thrust into the role of Hollywood mogul after gaining control of her ailing father’s media empire, claimed to enjoy a warm relationship with Leslie Moonves, CBS’s longtime chief executive. But new details emerging in the contentious lawsuit, now scheduled for trial in October, suggest a mounting wariness, distrust and misunderstanding on both sides, which made some kind of clash all but inevitable.

They also offer a rare behind-the-scenes look inside two powerful media companies — CBS and Viacom — that announced in February that they were holding merger talks but whose futures are now clouded by the intense public squabbling. (This column is based on court filings and interviews with people familiar with the circumstances of the rupture who declined to be identified, citing the pending suits.)

Ms. Redstone gained control of National Amusements, the Redstone family enterprise, from her 95-year-old father, Sumner M. Redstone. He had turned a small chain of movie theaters into a multibillion-dollar media empire spanning broadcast networks, cable television and films.

It was Mr. Redstone’s idea back in 2005 to split CBS and Viacom, on the then-reasonable theory that Viacom, with its Paramount film studio and cable channels Nickelodeon and MTV, would command a higher stock price on its own than coupled with the slower-growth CBS, with its broadcast network and book publisher, Simon and Schuster.

But CBS, under Mr. Moonves’s leadership, proved far more adept than Viacom at navigating a fast-changing media landscape.

Once Ms. Redstone gained control of Viacom two years ago, the company’s board fired its chief executive and replaced him with Robert A. Bakish, who had worked at Viacom for over 20 years. That decision has loomed over the CBS drama.

With rapid consolidation underway in media, and with the rise of video-streaming competitors such as Netflix and Amazon, a reunification of CBS and Viacom seemed likely, even inevitable, though some CBS shareholders objected to the idea of absorbing the struggling Viacom. In several conversations early this year, the 68-year-old Mr. Moonves — who National Amusements asserts has collected nearly $700 million in compensation during his tenure at CBS — assured Ms. Redstone he “wouldn’t stand in the way” of a merger and, in any event, was ready to move on to the “next chapter” in his life. That is according to Ms. Redstone and National Amusements; CBS denies that Mr. Moonves made any such remarks.

Image

Shari Redstone, the president of National Amusements, which controls CBS and Viacom. Ms. Redstone wants to combine the two media companies.CreditRyan Stone for The New York Times

On Jan. 16, the two met alone at Mr. Moonves’s CBS office in Los Angeles, and Ms. Redstone told him that she would be willing to give up voting control of a reunited company. She, too, was eager to focus more on her family and philanthropic interests, she said.

Ms. Redstone also proposed adding Richard Parsons, the former chairman and chief executive of Time Warner, to CBS’s board. Mr. Moonves didn’t object; Mr. Parsons is much admired in the media and entertainment industries.

Still, to CBS it was a sign that Ms. Redstone was injecting herself into the choice of board members. That raised the specter of a repeat of what had happened at Viacom — when Ms. Redstone had purged the board allied with the previous chief executive — especially since Ms. Redstone also wanted to remove another CBS director and Moonves ally, Charles Gifford.

According to the National Amusements complaint, Ms. Redstone wasn’t trying to wrest control of CBS’s board. Rather, Mr. Gifford, a former top banking executive, had offended Ms. Redstone at the 2017 Super Bowl in Houston when he acted in an “intimidating and bullying” manner, “grabbing her face and directing her to listen to him.”

Mr. Gifford, who was using a cane as he walked on the field before the game, has said he was simply trying to hug Ms. Redstone as a greeting.

Adding to Mr. Moonves’s anxieties about Ms. Redstone’s intentions, she told him at the January meeting that it was important for Viacom’s Mr. Bakish to have a “significant” role in a merged CBS-Viacom. According to National Amusements, Mr. Moonves asked if that meant Mr. Bakish had to be his “No. 2,” and Ms. Redstone stressed that it only meant he had to have a “meaningful role.” (CBS acknowledges that Mr. Bakish’s role was discussed, but otherwise denies this account.) For his part, Mr. Moonves felt the merger could succeed only if he had the unfettered ability to select his own management team.

The meeting was sufficiently contentious that when it was over, Ms. Redstone and Mr. Moonves “affirmed their mutual desire for peace” and agreed to avoid “fighting publicly,” according to National Amusements. (CBS disputes this, saying the meeting ended “on positive terms.”)

Despite the tension, in the next few months special committees of each company’s board began discussing a potential merger. On April 3, CNBC’s David Faber reported CBS’s proposed merger terms — which is how Ms. Redstone first learned them, according to National Amusements. As the controlling shareholder, she felt she at least deserved a phone call.

A month later, on May 1, Mr. Moonves and Ms. Redstone met at Mr. Moonves’s Park Avenue apartment to discuss the Gifford and Bakish issues. This time, each brought along a witness: Mr. Parsons for Ms. Redstone, and the CBS director Bruce S. Gordon, a former chief executive of the N.A.A.C.P., for Mr. Moonves. It was hardly a sign of mutual trust.

From Ms. Redstone’s standpoint, Mr. Moonves seemed jealous of Mr. Bakish, who she felt was doing a good job reviving a demoralized Viacom. Mr. Moonves complained that she “liked Mr. Bakish more than him,” according to National Amusements. Ms. Redstone tried to assuage Mr. Moonves’s concerns, telling him that she “had a closer personal relationship with Mr. Moonves than with Mr. Bakish” and that she wanted Mr. Moonves to run the combined company. Still, she wouldn’t insist that Mr. Bakish be part of the management team, she at least wanted him on the board of the combined company. Mr. Moonves was noncommittal. (CBS denies that any of this was said.)

Image

Robert A. Bakish, third from left, with Ms. Redstone. Once Ms. Redstone gained control of Viacom two years ago, the company’s board named him chief executive.CreditCharley Gallay/Getty Images for Nickelodeon

The conversation turned to Joseph Ianniello, CBS’s chief operating officer and Mr. Moonves’s No. 2. Mr. Moonves complained that Ms. Redstone didn’t like Mr. Ianniello. She responded that she “barely knew him” but that he shouldn’t be a candidate to run the merged company or be Mr. Moonves’s heir because he’d never been a chief executive. (CBS acknowledges that Mr. Moonves raised the issue of “disparaging remarks” Ms. Redstone had made about Mr. Ianniello, but otherwise denies she made those comments.)

And Ms. Redstone again insisted that Mr. Gifford leave the board.

When the meeting ended, the two sides were at loggerheads over who would run the merged company and whether Mr. Gifford would serve on the board.

In what is likely the most startling revelation in the lawsuit, National Amusements maintains that Ms. Redstone was cooling on the idea of the merger, not because she felt it no longer made strategic sense, but because she doubted that Mr. Moonves would accept Mr. Bakish in any capacity, and without him, she didn’t believe that a merger would work. She began expressing this view to Viacom directors and to Mr. Bakish, though not to anyone at CBS.

Mr. Moonves and CBS had also turned against the merger, though they still believed Ms. Redstone was likely to force it through, even if the CBS board recommended against it. From CBS’s perspective, that was why Ms. Redstone wanted to get rid of Mr. Gifford — it was a first step toward handpicking a board that would execute the merger.

Mr. Moonves never got back to Ms. Redstone about Mr. Bakish and Mr. Gifford. Instead, on May 14, CBS filed the lawsuit to strip Ms. Redstone of voting control, dropping any pretense of friendliness or cooperation.

The irony is that, although both sides deeply distrust each other, the broad contours of the narrative aren’t in dispute. That suggests the two sides aren’t really that far apart.

Most important, neither wants a merger. If CBS and Viacom remain separate companies, with separate boards and management, there’s no need to pick between Mr. Moonves, who could remain CBS’s chief executive, and Mr. Bakish, who could continue his turnaround effort at Viacom. The CBS board could develop its own succession plan.

Alone or together, CBS and Viacom are potential takeover candidates, as shown by the recent bidding war for most assets of 21st Century Fox. The companies would be even more attractive — and would very likely fetch more money — if Ms. Redstone gave up her voting control. Even if she doesn’t want to go that far, she could signal her openness to acquisition offers.

In short, if Ms. Redstone and Mr. Moonves really care about shareholders as much as they claim, they should bury the hatchet and drop the lawsuits.

That is probably too much to hope for. Feelings are so intense that Ms. Redstone and Mr. Moonves can hardly be in the same room together. This month, they both attended the media conference in Sun Valley, Idaho, and pointedly avoided each other.

A version of this article appears in print on , on Page B1 of the New York edition with the headline: Frayed Ties Cloud Future For Viacom And CBS. Order Reprints | Today’s Paper | Subscribe