Six years ago, as the Murdoch empire was battling the outcry in the U.K. over the phone-hacking scandal involving the company’s newspapers, a former senior Fox executive wondered aloud in a private conversation: “When will it all come out?”

The executive was referring to Fox News; he was certain there were things going on behind the scenes at the network’s midtown Manhattan headquarters that would spark a comparable level of public outrage once exposed.

It took about five years, a generational transition among the Murdochs and a sexual harassment lawsuit filed by a fed-up female Fox News anchor to open the floodgates.

During the past 10 months, Fox News and parent company 21st Century Fox have been dragged across the Rubicon by a parade of scandals, settlements and legal actions that laid bare the ugly side of the hard-charging culture fostered by Fox News founder Roger Ailes. The April 19 firing of longtime Fox News star Bill O’Reilly amounted to an even bigger sign of fundamental change than the ouster of Ailes last July. Both men were felled by sexual harassment allegations that became too numerous and too contemptible to brush aside. O’Reilly, 67, and Ailes, 76, have steadfastly denied any wrongdoing.

The whirlwind of events has left Fox News in a state of crisis — the feeling of being in a “slow-motion car crash,” in the words of one Fox executive — and cast a shadow on Rupert Murdoch’s legacy as a leader for allowing the situation to fester. At the same time, the hasty departures of Ailes and O’Reilly have allowed Murdoch’s sons, James, 44, and Lachlan, 45, to exert the corporate authority handed to them by their father in June 2015.

When James became CEO of 21st Century Fox and Lachlan was named executive chairman alongside Rupert, there was much speculation about whether the scions would have the same business savvy and drive that made their father one of the most storied CEOs of the 20th century. As it turns out, a big early test of James’ and Lachlan’s derring-do has come in the form of judgment calls on decisions that have put people over profits.

21st Century Fox veterans say the corporate culture across the entire company is inevitably changing now that it’s being driven by Murdochs in their mid-40s rather than the 86-year-old patriarch. Business sources point to a similar transition throughout the industry as executives who launched their careers in the 1970s and ’80s are succeeded by those who were in elementary and middle school when Ronald Reagan was in the White House. The mindset is inevitably different.

By many accounts, James and Lachlan pushed their father to take action on Ailes and O’Reilly after investigations by the outside law firm of Paul, Weiss, Rifkind, Wharton & Garrison uncovered allegations among internal staffers. “There’s a whole generation of guys across the business who would probably not survive the kind of investigation that [Ailes and O’Reilly] were put through,” one veteran female Fox exec observes.

A source who knows the Murdoch clan well describes the situation as an example of personality and generational differences between father and sons. Rupert Murdoch loves being a contrarian and railing against conventional wisdom. He’s also known to be loyal to those who have delivered for his company, and by any measure, O’Reilly was a superstar in the Fox firmament. As the pressure mounted over the host’s behavior, Rupert’s instincts were to circle the wagons behind his guy.

James had a better grasp on how strong the public backlash would be to the onslaught of reports this month about O’Reilly’s alleged behavior and the $13 million in settlements paid to five women by him and Fox News since 2004. As advertisers fled “The O’Reilly Factor” and protesters gathered outside 21st Century Fox’s headquarters in New York, James and Lachlan were able to persuade their father that O’Reilly had quickly become more of a liability than an asset. To wit, the company is already facing a probe by the U.S. Attorney’s office into its handling of settlements from the Ailes era and whether they were properly reported to 21st Century Fox shareholders.

The situation became even more urgent for the Murdochs when activists leading the campaign to pressure advertisers found another vulnerable spot for 21st Century Fox: its pending $15 billion takeover of European satcaster Sky. African-American civil rights group Color of Change and other organizations last week filed a petition critical of Fox with U.K. regulator Ofcom, which is expected to issue a decision by June 20 on whether the conglomerate is “fit and proper” to consolidate such a large media asset. Fox was already facing an uphill battle: The memory of the phone-hacking scandal — which torpedoed Fox’s previous effort to buy out the remaining 61% interest in Sky — remains fresh in the U.K.

In hindsight, Rupert Murdoch missed an opportunity to burnish his image by thoroughly overhauling Fox News. He took on direct oversight of the network as division chairman in the midst of the storm that led to Ailes’ hasty exit. Insiders credit Murdoch with revving up new initiatives, particularly on the digital front, which had languished during the final years of Ailes’ reign.

But the decision to renew O’Reilly’s contract despite the awareness of the pervasive harassment claims — the kind of behavior Fox said it would not tolerate at the time of Ailes’ ouster — sent a loud-and-clear message throughout the company.

Multiple Fox sources view the tarnish that Fox News’ sexual harassment scandals will bring to Rupert as unfortunate because the media baron is unfailingly gracious and respectful on a personal level to his employees, male and female. Sources who have worked with Murdoch for decades say they have never heard him make an untoward comment about women in a work setting, nor even the relatively innocuous remarks about physical appearance that female executives are long accustomed to receiving.

The hothouse environment described within the walls of Fox News also clashes with the atmosphere at Fox’s Hollywood-based businesses, where the studio and networks have been industry leaders in fostering diversity and promoting women to top posts. At the senior manager level, executives say there’s long been an emphasis on adhering to best practices in business ethics.

At the same time, Rupert Murdoch historically has given his leaders lots of leeway to run their divisions so long as they are running well. Fox News from the start under Ailes operated with an unusual degree of independence, functioning as if it were walled off from the rest of the company. The cable channel has never been integrated with Fox’s other cable channels but rather maintained its own advertising and affiliate sales operations. Fox News had its own general counsel, human resources and administrative departments, such as payroll.

That separation has long made Fox executives feel like Fox News was an entirely separate company, a buffer that has been comforting when controversies about the news network’s coverage or personalities erupted. With Ailes gone, it’s expected that over time Fox News will be more closely integrated with the rest of the company’s cable operations.

Ailes was the architect, but O’Reilly was the face of Fox News from its earliest days in 1996. The hasty demise of “The O’Reilly Factor,” the top-rated 8 p.m. hour in cable news, will undoubtedly cost the network viewers and stature, at least in the short term. Coming on top of the loss of next-generation Fox News star Megyn Kelly to NBC News in January, 21st Century Fox is now forced to manage its way out of a crisis moment — one that few saw coming this time last year — in the division that is its single biggest profit center, contributing 20%-25% of operating income.

The damage isn’t limited to Ailes and O’Reilly. Fox News in February fired longtime comptroller Judy Slater ahead of a racial discrimination lawsuit filed by three African-American female employees. The trio accuse Slater of subjecting them to shockingly racist comments and a pattern of inappropriate behavior — including relentless teasing of a woman for having had a mastectomy — that if true could not have flown entirely under the radar of senior management. A common thread in many of the cases that have surfaced notes superiors warned that the human resources department would not take action on employee complaints.

The multiyear renewal of O’Reilly’s contract, which had been set to expire at the end of 2017, was made shortly after Kelly left for NBC News in January, but the deal was kept quiet because Fox execs were well aware that The New York Times was readying an expose of O’Reilly’s history of sexual harassment settlements. It’s hard to read that as anything but a calculation that Fox News execs believed O’Reilly would weather the controversy from the Times’ report, which was published April 1.

To hedge its bets, the company had protections built into the O’Reilly deal to allow Fox an easier out if more allegations of inappropriate behavior surfaced. As it stands, O’Reilly is expected to exit Fox News with a payout of $25 million, equal to one year’s salary in a contract that was believed to run four years.

Before the O’Reilly storm hit, sources described Kelly’s decision to depart for NBC News despite a rich $20 million-a-year contract offer to stay as a turning point for James and Lachlan in their view of Fox News and its future. “I think that made them realized there was a lot of work needed to be done there to bring it into being a modern-day organization,” a senior Fox exec says.

Fox News has quickly rejiggered its primetime lineup to fill the void left by O’Reilly’s departure, handing the 8 p.m.

slot to “Tucker Carlson Tonight.” Carlson’s show had been on the air for only two months in the 7 p.m. hour before it was tapped in January to fill the 9 p.m. void left by Kelly’s exit. The program has surpassed expectations and maintained Fox News’ dominance in the hour, albeit with a big assist from its “O’Reilly Factor” lead-in. Beginning this week, Carlson will be tested in anchor slot.

Programming moves are only the start of changes expected in the coming months at Fox News. Executives who were part of Ailes’ core team are facing scrutiny and public pressure for assumptions that they looked the other way while questionable behavior was going on. However, there are signals from the top of Fox that Bill Shine and Jack Abernethy, the long-serving Fox News execs who were upped to co-presidents under Rupert after Ailes’ departure, are expected to remain in their posts, at least for now.

Sources close to the situation note that an evolution was inevitable at the company even if it hadn’t been rocked by scandal. Ailes, by many accounts, had been in failing health in his last few years on the job. O’Reilly was a reliable tentpole, but the host himself had hinted about possibly stepping down. Moreover, the median age of Fox News’ viewership is 68. As successful as the network has been in cable, there wasn’t much of a plan in place with regard to succession on the air.

Off the air, it falls to Lachlan and James to see if they can continue to build on the foundation their father laid at Fox News despite its challenged future.