GLENN BECK and Bill O’Reilly did not miss the chance to gloat. Fox News Channel, the television presenters’ former employer, has lost its grip as America’s most-watched cable-news channel. Among prime-time viewers aged 25 to 54—the most important cohort for advertisers—the station that has long topped the ratings chart found itself in third place for five consecutive days last week, trailing both CNN and MSNBC. It was the first time that had happened in 17 years. “Is this the beginning of Fox actually having to work hard to keep its place?” Mr Beck, who left the channel in 2011, asked in a podcast. “It doesn’t look like [Fox] has a plan,” replied Mr O’Reilly, a ratings-topping Fox host, who was sacked last month after a wave of sexual-harassment allegations against him set off a boycott by advertisers.

Fox’s tumble down the cable league table has coincided with a period of unprecedented tumult at its headquarters. Roger Ailes, its powerful former chief, transformed the channel into a conservative-news juggernaut, but was forced out in 2016 after numerous employees accused him of sexual harassment. He died on May 18th. Greta Van Susteren, a star anchor, has moved to MSNBC, while Megyn Kelly, whose ratings trailed only Mr O’Reilly’s, left the network for NBC in January. The network has rebuilt its stable from within, drafting replacements like Tucker Carlson, a right-wing commentator known almost as much for his bow ties as he is for his political analysis.

Nonetheless, the fact that Fox has lost ground just as its old guard moved on is probably a coincidence. The channel’s viewership during Ms Kelly’s old 9pm slot actually soared shortly after Mr Carlson replaced her, and held steady in the 8pm hour after Mr Carlson switched to that time to fill in for Mr O’Reilly. If Rupert Murdoch, the boss of Fox’s parent company, is looking for scapegoats, he should train his fire instead on the man whom Fox’s sympathetic coverage helped get elected as president.

The start of Donald Trump’s presidency was kind to Fox. After eight long years under Barack Obama, right-leaning viewers flocked to their go-to channel to bask in his inauguration and extremely short-lived honeymoon. In recent weeks, however, Mr Trump has been buffeted by scandal following his firing of James Comey, the director of the FBI. In response, audiences thirsty for negative coverage of the president—whose approval rating is now 16 percentage points underwater—are gleefully tuning in to MSNBC, Fox’s left-leaning competitor. In contrast, the torrent of negative headlines about Mr Trump may have made his supporters less likely to watch cable news at all. The overall pattern is impossible to mistake: each point of net approval rating the president loses has corresponded to a loss of some 20,500 prime-time viewers aged 25 to 54 for Fox, and a gain of nearly 2,300 for MSNBC.

Moreover, the head-in-the-sand approach of Fox’s conservative prime-time anchors may have lulled many of those who remained loyal to the channel to sleep. Mr Carlson has downplayed investigations into ties between Mr Trump’s presidential campaign and Russia’s efforts to manipulate the 2016 election as “Russia hysteria”. And Sean Hannity, the last man standing from the network’s old line-up and Mr Trump’s most loyal defender in the media, has filled his airtime by drumming up conspiracy theories about a murdered staffer for the Democratic party. Fox has subsequently retracted its claims about the case.

News cycles move quickly, and even a former reality-television star like Mr Trump cannot command the narrative all the time. When a big story that did not reflect negatively on the president broke on May 22nd—the suicide-bombing at a pop concert in Manchester, England—Fox’s ratings shot back up. But in the long run, the business and political agendas of openly partisan media outlets may well be irreconcilable. The easiest way to win the ratings wars is to have the presidency held by the opposite party, so that furious ideologues know where to turn to stew over the latest outrage from the White House.