Bill O'Reilly's 21-year career at Fox News has come to a sudden and ignoble end.

"The O'Reilly Factor" has been canceled amid a cloud of harassment allegations against the conservative broadcaster.

Rupert Murdoch and his sons James and Lachlan, who run 21st Century Fox, made the announcement Wednesday afternoon.

"After a thorough and careful review of the allegations, the Company and Bill O'Reilly have agreed that Bill O'Reilly will not be returning to the Fox News Channel," Fox said.

In a statement of his own released later Wednesday afternoon, O'Reilly said, "It is tremendously disheartening that we part ways due to completely unfounded claims. But that is the unfortunate reality many of us in the public eye must live with today."

It is unclear if Fox News is paying O'Reilly. The host is presumably owed tens of millions of dollars under the terms of his multi-year contract, though the contract may have contained clauses allowing Fox News to get out of the deal.

It is also unknown if O'Reilly is subject to a so-called "non-compete" clause limiting his ability to appear on other networks.

Related story: What will Bill O'Reilly do now?

O'Reilly's ouster shocked the television news industry, including Fox's own employees. While the broadcaster was not well-liked inside the network, he was viewed as invincible.

Wednesday's outcome "is stunning because Bill O'Reilly WAS Fox News," former Fox contributor Kirsten Powers said on CNN's "Anderson Cooper 360."

Powers, who moved to CNN last summer, said "it was sort of unthinkable that he would ever leave there, except on his own terms."

What changed? An investigation by The New York Times. After founding Fox News CEO Roger Ailes resigned under a cloud of sexual harassment allegations last summer, the Times looked into allegations in O'Reilly's past.

It found that O'Reilly and Fox had reached settlements totaling $13 million with five women who had accused O'Reilly of sexual harassment or verbal abuse, only some of which had previously been reported publicly.

The Times published its reporting on April 1. Within days, there was an advertiser exodus -- dozens of sponsors told Fox to remove their ads from "The O'Reilly Factor."

There was also a crucial phone call from an O'Reilly accuser to Fox. On April 5, Wendy Walsh called Fox's hotline and described what she said was harassment and retaliatory behavior by O'Reilly back in 2013.

This was significant because O'Reilly and Fox had said that none of the women accusing O'Reilly of improprieties had ever contacted human resources or called the hotline.

Walsh and her attorney Lisa Bloom publicized the phone call. The Murdochs responded to the call by asking the law firm Paul, Weiss to conduct an investigation.

The results of the internal probe were not shared publicly. But it apparently influenced the Murdochs' decision.

In a letter to employees on Wednesday, Rupert Murdoch said O'Reilly's exit followed "an extensive review done in collaboration with outside counsel."

The involvement of Paul, Weiss was instrumental in Ailes' eventual resignation.

In the letter, Murdoch praised O'Reilly as "one of the most accomplished TV personalities in the history of cable news" before saying "we want to underscore our consistent commitment to fostering a work environment built on the values of trust and respect."

The letter concluded with an apparent nod to morale problems within Fox News recently.

"I understand how difficult this has been for many of you," Murdoch wrote. "Thank you for your hard work, patience, and for the great job you all do delivering news and opinion to millions of Americans whose trust you earn every day. I look forward to even more success in the coming years."

Related: O'Reilly exit marks end of a Rupert Murdoch era, Brian Lowry says

Minutes after O'Reilly's departure was confirmed, Fox tried to turn the page by announcing a new, O'Reilly-less lineup, which will take effect on Monday, the day O'Reilly had been scheduled to return from vacation.

Tucker Carlson will move from 9 p.m. to take over O'Reilly's 8 p.m. slot, while the five-person talk show "The Five" will move to 9 p.m. with new co-host Jesse Watters.

Eric Bolling, who had been a co-host of "The Five," is taking over the 5 p.m. hour, though his new show will not debut until May 1.

On Wednesday night Dana Perino hosted the 8 p.m. hour on Fox, which was stripped of all O'Reilly branding. The show was simply titled "The Factor." Perino addressed O'Reilly's departure at the start and end of the show, but did not mention the reasons behind it.

In contrast to Fox News, Henry Holt, an imprint of Macmillan that has published O'Reilly's litany of best-selling books, said it was standing by him on Wednesday.

"Our plans have not changed," a spokeswoman said.

Liberal groups which had long opposed O'Reilly, and had been pushing advertisers to join the boycott, celebrated the news Wednesday.

"Advertisers fled because they immediately recognized what Fox News has ignored for over a decade: that serial sexual harassment is not only wrong, but bad for business. Without advertisers, Bill O'Reilly's show was no longer commercially viable. Fox News had no choice but to fire O'Reilly. Accountability came from the outside, not from within," Media Matters for America president Angelo Carusone said in a statement.

-- CNNMoney's Tom Kludt contributed reporting.