For Donald Trump and his legions of loyalists, the media has become a shared enemy.

To President Donald Trump, no place is more comfortable than the middle of a fight.This week had it all: Vicious tweets, nasty nicknames, an entrenched foe in the mainstream media and the reprisal by Trump of one of his favorite roles - the victim.Sure, Trump's health-care push stalled on Capitol Hill, his "energy week" went largely unnoticed and the president faced almost universal condemnation for an unpresidential attack on MSNBC anchor Mika Brzezinski.But to many inside the White House, as well as outside allies, what looked like a public relations debacle amounted to an abundance of "winning" - a Trumpian catchphrase playfully repeated Friday by some West Wing officials, even as they were discomfited by the Brzezinski broadside.Trump spent the week at war with what he calls the "fake news media," attacking some of the news organizations reporting most aggressively on Russian interference in the 2016 election. CNN gave him fresh ammunition with the resignations of three investigative journalists over a retracted story connected to the Russia probe.For Trump and his legions of loyalists, the media has become a shared enemy."They like him, they believe in him, they have not to any large degree been shaken from him, and the more the media attacks him, the more it becomes a self-fulfilling prophecy on the side of the Trump supporters who fervently believe the media treat him unfairly," said Tony Fabrizio, the chief pollster for Trump's campaign. "It's like, 'Beat me with that sword some more!' "Stoking the base was hardly a preplanned strategy. Instead, some White House officials described it as an inadvertent upside of the president's impulse to punch back at critics in the media.West Wing aides showed little support for Trump's Thursday morning tweet about Brzezinski's appearance. Deputy White House press secretary Sarah Huckabee Sanders defended it forcefully, but other top officials privately voiced disapproval and dismay at what they saw as a gratuitous and unnecessary swipe by their boss.Trump labeled Brzezinski "low I.Q. Crazy Mika," and called her co-host and fiance, Joe Scarborough, "Psycho Joe." The president charged that Brzezinski and Scarborough visited "Mar-a-Lago 3 nights in a row around New Year's Eve, and insisted on joining me. She was bleeding badly from a face-lift. I said no!"Trump's attack was roundly condemned by more than three dozen congressional Republicans and Democrats, as well as by Brzezinski and Scarborough, who responded to the president on their show Friday and in a column in The Washington Post."President Trump launched personal attacks against us Thursday, but our concerns about his unmoored behavior go far beyond the personal," the couple wrote in The Post. "America's leaders and allies are asking themselves yet again whether this man is fit to be president. We have our doubts, but we are both certain that the man is not mentally equipped to continue watching our show, 'Morning Joe.' "Fabrizio estimated that just a quarter of Americans know who Brzezinski is and predicted that conservatives would instinctively side with Trump, as they did when he attacked then-Fox News Channel anchor Megyn Kelly and other media personalities during last year's campaign."Everybody inside the Beltway knows who she is, but the average working guy doesn't know who she is," Fabrizio said of Brzezinski.Jason Miller, a former Trump campaign adviser who is close to the White House, said, "It does energize the base. . . Certainly a big part of the success the president had last year was this sweeping, counterculture pushback against information being dictated to the American people."Roger Stone, a former Trump adviser and longtime confidant, likened Trump's attacks on the media to the strategy employed by former president Richard M. Nixon to discredit organizations such as The Post that were breaking stories on the Watergate investigation."The difference is Nixon had no Internet-based alternative media [that] would aggressively cover his side of the argument," Stone said. He added that "the Trump constituency has deep distrust for the media as well as all political institutions," arguing that "lopsided coverage" of the president causes his voters to become angrier and more distrustful.The media can serve as an easy scapegoat, although that tactic is ultimately unlikely to pay long-term dividends, said Frank Sesno, a former CNN Washington bureau chief who is now the director of the School of Media and Public Affairs at George Washington University."The White House appears to have decided that one of its key talking points is going to be its war with the media, and this is an ongoing campaign that explains the president's misfortunes, rallies the base and gives some kind of meaning to the narrative of this presidency," Sesno said. "It may resonate with the base or at least some of the base, but it is utterly misguided. It will prove to be counterproductive, and I think it shows both the shallowness and the fundamental disrespect the White House has for the media and a free press."In a White House where the special counsel Robert Mueller III's widening Russia probe seems to have infused everything from the daily rhythms to the president's mood, the news about the three CNN journalists who had exited the network drew cheers.CNN came under fire after publishing a story alleging ties between Russia and Trump transition official Anthony Scaramucci that was retracted because the network said it did not meet CNN's editorial standards.West Wing officials viewed CNN's mistake as a public vindication that the Russia investigation - and its ensuing media coverage - is simply a "witch hunt," as Trump has labeled it. Trump and his aides also sought to publicize undercover videos released this week by a conservative group showing CNN employees saying disparaging things about the president and his supporters.Some White House advisers said they were frustrated that the Brzezinski feud - which continued to unfurl throughout the day Friday with accusations and counteraccusations - overtook the president's fight with CNN, which seemed in their eyes to have clearer villains and heroes.One senior White House official said Trump would prefer not to battle with the media but has grown exasperated by what he considers to be gross negligence and near-constant disparagement by The Post and the New York Times, as well as five of the six major television news channels: ABC, CBS, CNN, MSNBC and NBC. By contrast, Trump lavishes praise on Fox News, especially its popular morning show, "Fox & Friends," which reliably trumpets the president's point of view."Everyone would much prefer not to be at war," said the official, who spoke on the condition of anonymity to candidly address the president's mind-set. "I think we would much rather be getting covered fairly and not be in this constant, very hostile environment where things escalate very quickly between both sides."The official disputed the notion that the White House's hostility toward the news media has been an intentional strategy to rally Trump supporters."This isn't just us looking to be at war because it's appealing to our base," the White House official said. "I would much rather appeal to our base with positive news stories about all the things he's doing. I don't think he'll ever be treated fairly. I don't think he ever was treated fairly."But Trump has been short on major political wins and remains mired at historically low levels in public opinion polls. Health-care legislation, for instance, is stalled in the Senate, with senators heading home for the July 4 recess without holding a vote as originally expected. The administration has yet to unveil detailed proposals for tax reform or infrastructure, two other domestic priorities.Kellyanne Conway, counselor to the president, said on Friday that the media discussion about Trump has become "a one-way conversation of toxicity."

"It's incredible to watch people play armchair psychologist, outright ridiculing the president's physicality, his mental state, calling him names that you won't want your children to call people on a playground," Conway said on "Fox & Friends." "You would punish them for doing that, and then all of a sudden feigning shock when he wants to fight back and defend himself and hopefully change the conversation."