Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Bill O'Reilly's forced exit from Fox News is netting him a payout of up to $25 million, two sources with knowledge confirmed to NBC News.

The former Fox News anchor inked a new four-year contract last month guaranteeing he make that much annually, according to a person with knowledge of that deal. The contract did allow Fox to fire him in general if controversy was harming the network, the person added.

His severance has not been disclosed publicly, but was part of the agreement for him parting ways with parent company 21st Century Fox, New York magazine journalist Gabe Sherman earlier told TODAY.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The media company announced Wednesday it was dropping O'Reilly's prime-time political punditry show, "The O'Reilly Factor," amid mounting sexual harassment allegations made by former staffers and guests.

The New York Times revealed earlier this month that O'Reilly and his bosses paid about $13 million to five women in exchange for them not pursuing lawsuits or speaking about their cases.

In a statement following his ouster, O'Reilly said he was proud of his last 20-plus years at the cable network and again denied the accusations.

"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," said O'Reilly, 67, adding, "I wish only the best for Fox News Channel."

Related: How Much Money Did O'Reilly Bring in for Fox?

His payout would appear to be smaller than that given to former Fox News honcho Roger Ailes, who resigned last summer after facing his own spate of sexual harassment complaints made by female staffers. Ailes — who became the channel's founding CEO in 1996, the same year O'Reilly joined — reportedly received $40 million as part of his separation agreement. Ailes has also denied wrongdoing.

While O'Reilly was a star of the network, bringing in about 3.9 million viewers a night in recent months, Sherman said the accusations became too much — and even 21st Century Fox Chairman Rupert Murdoch could no longer justify keeping him on.

"Really this was a storm that the Murdoch family wanted to weather, but ultimately, they realized they couldn't," Sherman said.

Early Thursday, a giant poster of O'Reilly displayed prominently outside of 21st Century Fox's New York City offices was boarded up.