Ten arrests. An imperiled prime minister. Parliament under attack. Scotland Yard mortified and England’s largest tabloid shuttered. The scandal unfolding around Rupert Murdoch’s News Corp. finds a new victim or oozes a salacious tidbit every day — facts that would clearly delight Murdoch’s British tabloids if they weren’t at the center of the story.

At Tuesday’s hearing before an enraged Parliament, Murdoch — in addition to suffering a shaving-cream-pie attack — was grilled along with his son James about the turmoil engulfing his media empire. The elder Murdoch agreed that News Corp. should look deeply into journalistic practices at all its media properties around the world, which in the United States include the Wall Street Journal, Fox News and the New York Post. It was, as he said, “the most humble day of my life.”

Yet, as emotionally, psychologically and financially painful as media scandals can be, they are ultimately good medicine for a profession that demands accountability from those it covers — but often fails to see or admit its own shortcomings.

I know well what it’s like to live inside a media scandal. I recently stepped down as the ombudsman at NPR, where I served as an independent listener representative and wrote a blog about the network’s decision-making and foibles. Last fall, I experienced first-hand the backlash from the biggest scandal in NPR’s 40-year history: when management snapped and impetuously fired longtime news analyst Juan Williamsafter he said on Fox News that he got nervous when he saw people in “Muslim garb” on airplanes.

A new book by Williams, detailing his side of the story, shows how important it can be for a news organization to turn a scandal into an opportunity to improve and try to rebuild credibility.

“Muzzled: The Assault on Honest Debate,” gives Williams’s version of events, which, not surprisingly, conflicts with NPR’s. While I understood the decision to fire Williams after what had become an untenable relationship, the way it transpired was inexcusable and cost NPR greatly. By the time the Williams controversy — and a subsequent fundraising embarrassment in March — had blown over, NPR’s chief executive, chief fundraiser and head of news were gone, and federal funding for the public broadcasting system was in greater peril.

But NPR did one thing right: After Williams was summarily dismissed by phone following a decade with the network, NPR brass took a close look at what had happened and why. Clearly, he deserved better. (To contrast his treatment with another example, when I had to downgrade my assistant from full to part time because of budget woes, human resources walked me through every step and gave my assistant plenty of time to absorb the news.)

The truth, as I discovered through looking into many complaints about Williams, is that he had long been on thin ice for making opinionated comments on Fox, where he was a contributor, that he would not have been allowed to make on air for NPR. And NPR editors had been unhappy with the quality and preparation of his on-air work. It didn’t help that in 2007 the Pentagon wanted to pull NPR’s credentials in Iraq after Williams said incorrectly on Fox that Gen. David Petraeus had asked the White House for permission to go into Iran.

Williams was not let go because of one thing he said. It is true, as he writes in his book, that as the ombudsman, I got more correspondence about him than any other employee. What he fails to include was that most of it was negative before the firing, with folks complaining about comments he made on Fox. I came to feel like the de facto Fox News ombudsman.

It’s NPR’s fault that it looks like Williams’s right to free speech was violated, as he alleges. The network fired him with seemingly little thought to the consequences and with insufficient public explanation. To Williams, it was an issue of political correctness — he had violated a code by voicing his fears about Muslims. He says NPR, and then-news chief Ellen Weiss, were gunning for him because he appeared on Fox.

“My comments about Muslims on Fox were twisted and deliberately taken out of context by Weiss,” he writes. “She was able to use that distortion, along with a general view of Fox News as bad guys, to engage in a vigilante-style attack on me. NPR’s standards for its journalistic ethics, which I supposedly broke, seemed to apply only to me.”

Williams brought a valuable perspective to NPR, that of an African American with centrist-liberal credentials whose opinion was not always predictable. I liked him. But he is being disingenuous in calling his contract termination a free-speech issue. It was not because, as Williams writes, he “did not fit their view of how a black person thinks.”

It was a case of management snapping after years of warning him to be more careful. It was a fraught relationship that had outlived its usefulness, and NPR should have quietly let his contract expire rather than fire him over the phone. In fact, what Williams said was fairly innocuous. And the network’s impulsive reaction seemed to negate his comments later in the Fox segment, when he emphasized that we all need to be careful about stereotyping.

NPR was blindsided by the ensuing criticism. The network’s leaders failed to anticipate the reaction to firing one of their most prominent news personalities, one who had performed admirably for station fundraisers and, at the time, happened to be its only regularly featured African American male on-air voice.

Stung by the unprecedented public outcry, NPR underwent extensive soul-searching under then-chief executive Vivian Schiller’s leadership. NPR had never been attacked like this before. The network had grown comfortably accustomed to being regarded as special, as the outlet that presents the news with compelling storytelling, unlike anyone else. “Oh, NPR, I love NPR,” is what the people who worked there heard so often.

No longer the media darling, NPR wanted to know what it had done wrong.

The network paid a New York law firm more than $100,000 to investigate how the Williams firing was handled. Management hired a media ethics consultant to review the ethics code, and he held meetings with staff and listeners to plumb why this happened. They revamped the ethics code, changed the protocols for making and implementing personnel decisions, and intend to hire a standards and practices editor. They have hired more African American male reporters. And they brought in a crisis-management firm and developed a crisis communication strategy that might have averted the scandal. Hopefully, all this will make a difference.

As bruising as the Williams flap was, the steps the network took didn’t prevent a second major scandal five months later. In March, conservative activist James O’Keefearranged a sting in which two men posed as representatives of a Muslim charity(not the Muslim Brotherhood, as Williams writes) offering NPR $5 million. At a luncheon, which was secretly taped, NPR’s chief fundraiser spoke derogatorily of conservatives and behaved in an incredibly unprofessional manner. That incident cost Schiller and the fundraiser their jobs.

It’s clear to me that Williams’s Muslim remark and firing made NPR an attractive target for O’Keefe, and O’Keefe has said as much.

Media scandals are not a rarity. What is rare is turning the scandal into a self-reflective opportunity, admitting that your organization screwed up and begging your audience for another chance by instituting systemic changes to improve accountability.

The New York Times, for example, experienced a similar seismological newsroom upheaval upon discovering in 2003 that reporter Jayson Blair had plagiarized and made up stories. The Times assigned five of its own reporters to figure out how Blair got away with it, published a mea culpa explanation, revamped practices and hired a public editor to hold the paper more accountable. The Washington Post has also dealt with scandal, most notably after the paper discovered that its Pulitzer Prize-winning reporter, Janet Cooke, had made up the 1980 story for which she won the award. The Post’s ombudsman wrote a 14,000-word investigation, and the paper returned the prize.

Yes, many in the media are terribly arrogant (Williams also makes this point in his book). We work in a fairly insular environment and believe we are doing the Lord’s work. As a longtime media writer, I’ve seen countless newsrooms with cultures of complacency, feelings of superiority, attitudes of “we know best.”

Then disaster occurs, and a newsroom finds itself in trouble for fostering an environment in which a serial fabulist can work undetected or a tabloid can hack private voicemails — and the internal rot is exposed.

News Corp. should not hunker down. This is as serious a breach of trust as you can get. It’s also tarnishing, by association rather than evidence, Murdoch’s U.S. properties and the rest of the media world.

Tuesday’s testimony covered much of what Murdoch didn’t know or hadn’t done, and what he should do next. One item on his to-do list should be to subject his disgraced empire to the same scrutiny that his shuttered News of the World would have given any good scandal.

It was disappointing that when Murdoch was asked if he had already called for closer scrutiny of ethical practices at all his properties, he said no.

But then, the Murdochs have a lot going on right now.

Alicia Shepard completed her three-year term as NPR ombudsman on May 31. She is the author of “Woodward and Bernstein: Life in the Shadow of Watergate.”

Read Hustler publisher Larry Flynt’s take on the News Corp. phone-hacking scandal.

Read more from Outlook, friend us on Facebook, and follow us on Twitter.