Roger Ailes has resigned from Fox News amid sexual harassment allegations -- an ignoble end to his legendary, controversial twenty-year tenure running the country's dominant cable news channel.

Ailes' departure is effective immediately. Rupert Murdoch, the 85-year-old patriarch of parent company 21st Century Fox, is now the channel's chairman and acting CEO.

Ailes, 76, one of the most powerful men in the media business, was thought to be untouchable until two weeks ago, when ex-anchor Gretchen Carlson filed a lawsuit against him.

Within days, other women also came forward with similar accounts of harassment. Some of the allegations dated back to the 1960s; others were much more recent. Fox's 9 p.m. host Megyn Kelly told investigators that Ailes harassed her a decade ago.

Murdoch and his sons James and Lachlan, who jointly run the company, pressured Ailes to resign. Firing him outright was another option.

After Ailes' resignation was announced, Carlson's lawyers released a statement saying, "Gretchen Carlson's extraordinary courage has caused a seismic shift in the media world. We hope that all businesses now understand that women will no longer tolerate sexual harassment and reputable companies will no longer shield those who abuse women... We will have more to say in coming days as events unfold."

Ailes may also have more to say. He has repeatedly denied the harassment charges.

Related: Roger Ailes, exit on the right

In a letter to Murdoch, he initially said "I am proud of our accomplishments and look forward to continuing to work with you as a consultant in building 21st Century Fox."

However, a corporate source said that "consultant" is not an accurate word for what Ailes will be doing. Ailes will simply "be available to advise Rupert during the transition," the source said.

The letter was revised to replace "consultant" with "adviser."

Fox News staffers expressed astonishment about the sequence of events. Some said they believed that Ailes' exit was a power play by the Murdoch sons, who are said to dislike Ailes.

If that's what it was, it worked.

Shortly after 4 p.m. Thursday, Rupert and Lachlan Murdoch held a conference call with top Fox employees -- many of whom are in Cleveland covering the Republican National Convention -- to address the news. Sources on the call said that Rupert expressed sadness about Ailes' departure but encouraged the staff to stay focused on the work in front of them.

"The call felt like part funeral and part pep talk," Bret Baier, one of the network's lead anchors, said. "It is a sad day, but we have a lot of work to do tonight."

Some staffers described feeling sadness at the sudden exit of the man who had shaped so many of their careers.

"I can only speak for my relationship with Roger. I don't know about all the allegations. I only know -- and would like to focus on -- the Roger I know," Baier continued. "A man who was kind to me and my family and was a television genius."

For others, especially some female employees, there was anger at the fact that Ailes will continue to serve as an adviser and be paid by 21st Century Fox. One source said women were relieved that Ailes had been removed.

Ailes will receive in excess of $40 million, which accounts for the remainder he is owed under the terms of his multi-year contract with Fox.

Related: Fox without the $2.3 billion man will be a challenge

Insiders have speculated that Ailes could jump to a rival channel, but the corporate source said the exit deal includes a non-compete clause that would precludes such a move for an extended period of time.

Another option for Ailes -- once a feared Republican political consultant -- is a return to the political arena. He has had a friendly relationship with the GOP nominee Donald Trump for decades. The two men have been counseling each other by phone in recent days.

Trump, through a spokeswoman, declined to comment on Ailes on Thursday.

Ailes has had health problems in recent years, which may affect his decisions about what to do next.

Ailes is revered by some and reviled by others. Through Fox News, he reshaped American television news and Republican politics simultaneously.

Murdoch tapped Ailes to create and run the network in 1996, ushering in a controversial new era in cable news.

By hiring hosts like Bill O'Reilly and Sean Hannity and enforcing a conservative editorial point of view, Ailes developed a virtual public square for the American right and filled a void on television. It has dominated all other cable news channels for 14 years.

The channel claimed to be "fair and balanced," but in reality its programming was tilted in favor of conservative opinions and Republican politics, reflecting the views of Ailes himself. Fox mixed daily news reporting and nightly conservative opinion in ways that many critics found to be damaging to American discourse. But Fox's many fans said it was a necessary counterweight to liberal media bias.

Within six years, Fox came to dominate cable news ratings, dethroning CNN, and it has been a wildly successful business, with annual profits believed to exceed $1 billion.

Last year Fox News was the number two channel on cable, behind only ESPN.

Ailes was admired and envied for his talent management skills. But in recent weeks some women have described a darker side.

On the day Carlson sued, the Murdochs decided to conduct an internal review of the allegations.

An outside law firm interviewed present and past Fox employees. The New York Times reported on Wednesday that at least six other women told the lawyers that Ailes had behaved inappropriately toward them.

And on Thursday, Carlson's lawyers released a statement saying that they had received accusations of sexual harassment against Ailes from "more than 20 women." The claims could not be independently verified.

After being briefed on the initial findings from the investigation, the Murdochs concluded that Ailes must leave. Exit talks then began.

Rupert Murdoch was on vacation, but flew back to New York early to participate in the talks.

The drama at the network unfolded even as Fox was having its highest-rated year ever, and was three months away from the 20th anniversary of the channel's launch.

Maybe that's a convenient time for a change in leadership -- or maybe not. The succession plan is unclear. The corporate source said Rupert would be acting CEO for a period of "months."

But high-ranking sources at the network said they believed that actual day-to-day operations would be run by Bill Shine, the head of primetime and opinion programming, and Jay Wallace, who oversees daytime and news programming, while Murdoch makes some important calls from the top job.

Shine and Wallace were already running things day-to-day as negotiations picked up around Ailes' departure. Both men are in the running to replace Ailes, and have guided the network in the past when Ailes was absent.

There are conflicting reports about whether a talent "walkout" is possible in the wake of Ailes' departure. Fox's biggest stars, like O'Reilly and Baier, have something called a "key man clause" in their contracts, allowing them to leave the network if a key executive, in this case Ailes, leaves.

One of the allegedly rebellious hosts told CNNMoney on Wednesday that, contrary to a report on Breitbart News, there is no organized exodus in the works.

But another one of the hosts left the door open.

A talent agent said the hosts have to consider a number of factors: "Who takes over at Fox? What's the atmosphere like? What are the alternatives?"

There were many more questions than answers on Thursday evening.