NEW YORK (AP) — Fox News Channel's parent company fired Bill O'Reilly on Wednesday following an investigation into harassment allegations, bringing a stunning end to cable news' most popular program and one that came to define the bravado of his network over 20 years.

O'Reilly lost his job on the same day he was photographed in Rome shaking the hand of Pope Francis. By the evening, "The O'Reilly Factor" no longer bore his name, simply titled "The Factor."

The downfall of Fox's most popular — and most lucrative — personality began with an April 1 report in The New York Times that five women had been paid a total of $13 million to keep quiet about disturbing encounters with O'Reilly, who continued to deny any wrongdoing in a statement hours after he was fired. Dozens of his show's advertisers fled within days, even though O'Reilly's viewership increased.

O'Reilly's exit came nine months after his former boss, Fox News CEO Roger Ailes, was ousted following allegations of sexual harassment.

Following the Times story, 21st Century Fox said it had asked the same law firm that investigated Ailes to look into O'Reilly's behavior. 21st Century Fox leaders Rupert Murdoch and his sons Lachlan and James said in a memo to Fox staff that their decision to ax O'Reilly came following an "extensive review" into the charges.

"I understand how difficult this has been for many of you," Rupert Murdoch said in a memo to Fox staff.

O'Reilly, denied a chance to say goodbye to his Fox viewers, did so via a statement.

"It is tremendously disheartening that we part ways due to completely unfounded claims," he said. "But that is the unfortunate reality that 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."

O'Reilly's dismissal doesn't signal any change of direction for the network: Fox said conservative pundit Tucker Carlson would move into O'Reilly's time slot — the second time in three months he's replaced an exiting prime-time personality. Carlson, a veteran who has hosted shows on CNN, MSNBC and PBS, had taken over for Megyn Kelly in January when she announced she was moving to NBC News. "The Five," a talk show with five rotating hosts that regularly airs at 5 p.m. ET, will move into the 9 p.m. time slot. Eric Bolling will host a new show that airs at 5 p.m. starting next month, the company said.

Dana Perino, who had been subbing for O'Reilly who had been on vacation for the past few days, acknowledged his departure at the top of "The Factor." At the end of the show, she paid him a warm tribute.

Noting the "dramatic changes," Perino said: "It is the end of the era . Bill has been the undisputed king of cable news, and for good reason."

She also noted his devoted fans and their loyalty to the show.

O'Reilly, 67, had ruled the "no spin zone" on television with a quick smile and an even quicker temper. He pushed a populist, conservative-leaning point of view born from growing up on Long Island, and was quick to shout down those who disagreed with him. Fans loved his willingness to talk back to power or point out hypocrisy among liberal politicians or media members.

O'Reilly and President Donald Trump are both "crowd-pleasing showmen who know how to signal to loyalists in their audience that they are not taking themselves quite as seriously as their detractors are," said news consultant Andrew Tyndall. "Half of the fun that they have with their audiences comes from watching the outrage that they manage to provoke."

"What Rush Limbaugh was to talk radio, Bill O'Reilly has been to conservative television," said Mark Feldstein, communication professor at the University of Maryland. "You can't underestimate the influence and the profits that he brought into Fox News for all these years and that's why they hesitated so long in doing the right thing."

His show generated $178 million in advertising revenue in 2015, according to Kantar Media. Before the advertising boycott, there was the prospect of even more: his audience was larger in the first three months of 2017 than it has ever been. With a profit center gone, 21st Century Fox stock fell almost 1 percent Wednesday in heavy trading.

O'Reilly's pugnacious personality wasn't just an onscreen affectation, with one of the settlements going to a woman who complained about being shouted at in the newsroom. O'Reilly was alleged to have slowed the careers of women who spurned his advances. One former Fox personality, Juliet Huddy, said she pulled away and fell to the ground when he tried to kiss her, and he didn't help her up, the Times reported.

One harassment case, from a former producer who said O'Reilly called her and described sexual fantasies and appeared to be masturbating, dated back more than a decade and was widely reported then. While O'Reilly survived then, the accumulation of cases outlined in the Times damaged him much more extensively. For Fox executives, it wasn't clear when it would end: a campaign to target advertisers was continuing, a group of women demonstrated in front of Fox's headquarters Tuesday and another woman, a former clerical worker at Fox, called a harassment hotline and accusing the host of boorish behavior.

Some of O'Reilly's critics were happy with the news.

Author Stephen King tweeted: "New book by Fox News: Killing Bill O'Reilly." It referred to O'Reilly's series of best-selling books on the deaths of major historical figures.

"Mission accomplished," said Keith Olbermann, who frequently tweaked O'Reilly on an MSNBC show that competed in the same time slot for several years. Olbermann said that when he was working at Fox Sports in 1999, he helped a friend get a job at Fox News. She quit the job — and the business — due to her treatment by O'Reilly, he said.

"This has been going on for decades and I hope his having to go out in shame and disgrace makes things just a little bit better for her and all his victims right now," he said. "Certainly they make things better for America."

But many of O'Reilly's fans took to social media to express their unhappiness at losing their hero. Several suggested that Fox had essentially caved to a left wing campaign. It didn't help that the controversy was set in motion by the Times, a publication hated in conservative circles.

O'Reilly's lawyers said he was the victim of an orchestrated campaign by liberal organizations like Media Matters for America, which contacted his advertisers to pressure them to leave the show. Conservative personality Glenn Beck — who once lost a job at Fox because a similar campaign choked his program of paying advertisers — came to O'Reilly's defense on his radio show.

"You need to write and call Fox News Channel today and tell them, you can lose your advertisers or you can lose your viewers," Beck said on his radio show hours before the firing. "But you have to put some spine back into the Murdoch family and the Fox News Channel board because you are about to lose Bill O'Reilly."

He was too late.

O'Reilly is also one of the country's most popular nonfiction authors. The books in his "Killing" historical series, including "Killing Lincoln" and "Killing Reagan," have consistently sold 1 million or more copies in hardcover, a rare achievement in publishing, and his platform on Fox enabled him to promote his work. He has also had best-sellers with everything from the memoir "A Bold Fresh Piece of Humanity" to his most recent work, "Old School," which includes passages urging the respectful treatment of women.

O'Reilly and co-author Martin Dugard are due to release another book in the "Killing" series in September, and a spokeswoman for publisher Henry Holt and Co. said that plans had not changed.

Vatican spokesman Greg Burke confirmed O'Reilly was in the VIP section for the pope's Wednesday appearance. Burke, a former Fox News correspondent in Rome, denied having facilitated the tickets. Such tickets can be obtained via special request to the papal household from embassies, high-ranking churchmen or Vatican officials.

Francis always swings by the VIP seats at the end of his audience for a quick round of handshakes. A photographer from the Vatican newspaper L'Osservatore Romano snapped a photo of Francis reaching out to shake his hand.

___

AP writers Nicole Winfield in Rome; Hillel Italie and Marley Jay in New York; and Lynn Elber in Los Angeles contributed to this story.

___

This story has been corrected to show that the downfall of O'Reilly began with an April 1, not April 2 report in The New York Times.