Fox News is cutting ties with Bill O’Reilly, the biggest star in its 20-year history, after mounting allegations of sexual harassment and inappropriate behavior prompted the network to end his program.

“After a thorough and careful review of the allegations,” parent company 21st Century Fox said in a statement, “the company and Bill O’Reilly have agreed that Bill O’Reilly will not be returning to the Fox News Channel.”

Wednesday's decision seemed unimaginable a few short weeks ago, given O’Reilly’s long reign as the top-rated host in cable news.

" ... the company and Bill O’Reilly have agreed that Bill O’Reilly will not be returning to the Fox News Channel."

— Statement from 21st Century Fox

But the climate shifted dramatically after The New York Times reported on April 1 that O’Reilly or Fox had paid $13 million to settle five cases against him alleging sexual or other harassment. More than 50 advertisers withdrew from his prime-time show, and 21st Century Fox asked a law firm to investigate a complaint from a woman who said O’Reilly dropped efforts to make her a contributor in 2013 after she turned down his invitation to visit his hotel room.

O'Reilly said in a statement Wednesday: “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. I will always look back on my time at Fox with great pride in the unprecedented success we achieved and with my deepest gratitude to all my dedicated viewers. I wish only the best for Fox News Channel.”

O’Reilly, 67, had not previously commented on his status since leaving on vacation last week—he met Pope Francis Wednesday in a VIP line at the Vatican—but his lawyer issued a blistering statement Tuesday accusing his liberal opponents of a “smear campaign.”

The statement said O’Reilly “has been subjected to a brutal campaign of character assassination that is unprecedented in post-McCarthyist America.”

Starting Monday, Fox will air Tucker Carlson’s show an hour earlier, in O’Reilly’s 8 p.m. ET slot, and move the popular ensemble show “The Five” from 5 to 9 p.m. On May 1, “Five” member Eric Bolling will debut a one-hour program at 5 p.m., and Martha MacCallum will make her “First 100 Days” show permanent at 7 p.m.

O’Reilly’s departure comes nine months after Fox News founder Roger Ailes was forced out as chairman following a sexual harassment lawsuit by former host Gretchen Carlson and allegations by at least a half-dozen women, all of which he denied. One of them was Megyn Kelly, who also clashed with O’Reilly and who decided to leave Fox for NBC last December.

The net result is not just a transformation of Fox’s prime-time lineup, which has trounced the cable competition, but an effort by Rupert Murdoch and his sons, James and Lachlan, to change the company’s culture and make clear that harassment is unacceptable. That became increasingly difficult, and spawned resentment among some female staffers, as O’Reilly’s problems became a dominant news story.

Fox had recently signed O’Reilly to a new multi-year contract, even as executives knew the Times story was coming.

The “O’Reilly Factor” has spawned a cottage industry, with the host, who was part of the channel’s original lineup in 1996, producing a slew of best-selling books and finding himself in demand for lucrative speaking engagements. It has been a cash cow for Fox News Channel, generating about $178 million in ad revenue in 2015, according to an estimate by Kantar Media. And his ratings remained stratospheric by cable standards, averaging just under 4 million viewers in the first quarter of this year and rising even after the allegations published by the Times.

O’Reilly has survived controversial episodes in the past. One of the settlements cited by the Times drew extensive publicity in 2004, when one of his former producers, Andrea Mackris, accused him of sexually explicit phone calls. O’Reilly countersued before both sides settled the case.

Two years ago, O’Reilly came under attack for having claimed to cover the 1982 Falklands War although he had not actually been on the Falkland Islands. He blamed liberal critics for using semantics to falsely accuse him.

Most of his positions were conservative, and he maintained a cordial relationship with President Trump after having been consistently tough on President Obama. But O’Reilly styled himself an independent, sometimes took moderate stances and supported Obama’s “My Brother’s Keeper” initiative aimed at helping black youth. And there was a strong populist streak to his commentary, whether he was assailing rap music, media bias or what he branded the "War on Christmas."

Even most of his critics acknowledged that O’Reilly, a former correspondent for CBS and ABC and onetime host of “Inside Edition,” is an extraordinary broadcaster whose blustery, sometimes confrontational style kept putting people in the seats.