The announcement on Sunday evening ends his 20-year tenure atop one of the country’s most important media empires.

It also concludes a months-long battle for control of CBS between Moonves and the company’s controlling shareholder, Shari Redstone. The CBS board is being reshaped, with six new directors, and Redstone is repeating her vow to consider new bids from potential buyers.

The shakeup may position CBS for a sale. But the company is also facing some continued reputational risk. There is widespread scrutiny about the prospect of Moonves being paid tens of millions of dollars on his way out the door.

Moonves is one of the media world’s highest paid CEOs, so his severance package would normally be generous, even gargantuan.

But a huge payout to Moonves could stir shareholder ire in light of the disturbing harassment and assault allegations that have piled up against him.

With those optics in mind, CBS said Sunday night that Moonves and CBS will donate $20 million to organizations that support the #MeToo movement and other groups fighting for workplace equity for women.

The donation, which will be made immediately, will come out of any severance that Moonves might eventually be given.

Earlier in the day, a source said that Moonves stands to earn upward of $100 million.

But Sunday evening’s announcement specified that any severance “will depend upon the results” of the ongoing internal investigations into his behavior.

In other words, the details and dollar amounts may not be determined for weeks or months.

The departure of Moonves is effective immediately. Joseph Ianniello, who has been the CBS chief operating officer since 2013, will serve as president and acting CEO while the board looks for a new CEO.

Sunday’s developments are an extraordinary confluence of events — a boardroom battle royale and a #MeToo case at the C-suite level.

Moonves and Redstone were locked in a tug of war even before July 27, when Ronan Farrow of The New Yorker first reported on alleged harassment by Moonves. The CBS board initially resisted calls for Moonves to be suspended or forced out.

But his continued leadership of CBS became “untenable,” an executive told CNN.

With settlement talks already underway, Farrow published a followup story on Sunday. He wrote that “six additional women have accused the television executive of sexual misconduct, as the board of the CBS Corporation weighs the terms of his departure.”

The CBS board had already hired two law firms to do an investigation. Now the firms have even more to examine.

Boardroom battle and huge financial stakes

Moonves’ allies will surely cast his exit as a corporate coup — a successful effort by Redstone to gain a tighter grip on CBS.

Redstone’s allies will point to her position as controlling shareholder; accuse Moonves of plotting a jailbreak attempt; and cite the misconduct allegations.

Moonves is the first CEO of a Fortune 500 company to leave his job amid harassment allegations in the year since two investigations of Harvey Weinstein (one of them by Farrow) jump-started the #MeToo Movement.

Farrow tweeted out that “he will no longer receive any exit compensation, pending outcome of investigation, and that a portion of those funds will go to #MeToo causes.”

That’s what advocacy groups like the Times Up initiative would like to see.

Times Up said in a statement on Sunday afternoon, “We will accept nothing less than full transparency of the investigation’s findings, a commitment to real change across all levels of CBS management and no reward for Les Moonves.”

Representatives for CBS and Redstone declined to comment, ahead of the official announcement.

CBS chief operating officer Joe Ianniello is expected to run the company on an interim basis.

Among other challenges, Ianniello will have to restore confidence in the culture of CBS.

In Farrow’s first story, six women, some of whom were named, alleged harassment and other misconduct by Moonves and connected it to deeper problems at the company.

Some of the claims dated back several decades. Moonves acknowledged making mistakes in his past but said he never abused his power. Of all the “Me Too” cases in the past year, this one stood out for several reasons, including the fact that Moonves is a powerful CEO of a major publicly-traded corporation.

Members of the CBS board of directors — the same directors who had been backing Moonves in the dispute with Redstone for months — did not suspend Moonves or force him to step down.

Instead, the board retained a pair of law firms to investigate the allegations.

Moonves kept a relatively low profile in August, but remained in charge of the broadcasting behemoth.

It is unclear when he first knew that he had to go.

Some sources close to Moonves said in August that he had vowed to fight both the allegations of wrongdoing and the legal war against Redstone.

But another source said he knew his exit was inevitable several months ago, even before Farrow’s first story came out.

The accusations in the second story are even more serious.

‘Serious allegations,’ denials and ongoing investigations

“These are more numerous claims, these are six women all of them on the record, also describing more serious allegations,” Farrow said on CNN’s “Reliable Sources” shortly after The New Yorker published the followup. “This includes multiple allegations of either physically forced or coerced oral sex. It includes a case that resulted in a criminal investigation.”

Moonves told Farrow in a statement that the “appalling accusations in this article are untrue.”

He said he had consensual relations with three of the women named by The New Yorker “some 25 years ago before I came to CBS.” He reiterated that he never abused his power and said he can only surmise that the allegations “are surfacing now for the first time, decades later, as part of a concerted effort by others to destroy my name, my reputation and my career.”

Farrow had a different explanation.

He said on CNN that “these women are coming out now” because “they have been extraordinarily frustrated by what they perceive to be inaction on the part of CBS and its board. And that really is integral to what prompted this followup story.”

While the law firms have been investigating, Moonves has been “allowed to stay and continue to run the company,” a different outcome than many other “Me Too” cases, Farrow noted.

CBS responded to the new story by saying in a statement, “CBS takes these allegations very seriously. Our board of directors is conducting a thorough investigation of these matters, which is ongoing.”

Farrow indicated that CBS has been aware of the new allegations for at least several days. “In the last week, as we reached out to CBS for comment,” stories emerged about exit talks, Farrow said.

The Los Angeles Times reported on Wednesday night that CBS board members were talking about Moonves’ potential exit. Discussions had focused on the size of a severance package, and on whether Moonves would move to a producer role, the Times reported.

Under the terms of his contract, Moonves would be owed almost $180 million if removed without “cause.” But if he is removed “for cause,” relating to the harassment allegations, for example, such an eye-popping severance package would not be in play.

“As of a couple of days ago, they were still talking about potentially letting him leave with a very generous exit package, up to the neighborhood of $100 million,” Farrow said on CNN. “Many of the women found that very, very frustrating. They felt this was a board that has let a powerful man who makes a lot of money for this company, in the words of one person, ‘get away with it.'”