D.C. Mayor Muriel E. Bowser (D). (Jahi Chikwendiu/The Washington Post)

D.C. Mayor Muriel E. Bowser didn’t wake up Friday expecting to trade body blows on Twitter with the president of the United States. Then the phone rang.

“I was feeding my baby,” Bowser (D) said in an interview. “I got a call that I had made it to Donald Trump’s — or the city had made it to Donald Trump’s — Twitter feed.”

Just before 8 a.m., the president had taken a shot at D.C.’s “local politicians,” blaming them for running up security costs and forcing the cancellation of a military parade. Within the hour, Bowser fired back — and, with one deftly composed tweet, became a star in the national social-media arena frequented by Trump critics.

“Yup, I’m Muriel Bowser, mayor of Washington DC, the local politician who finally got thru to the reality star in the White House with the realities ($21.6M) of parades/events/demonstrations in Trump America (sad),” she wrote.

It was a rare show of adversarial flair by a mayor whose even-keeled approach to the many provocations the Trump administration has directed toward Washington and other big cities has not always been welcomed by some of her constituents.

Bowser, a private and habitually cautious politician who is on a glide path to reelection in November, is not known for grand gestures or showiness. When she adopted her child in May, she eschewed the publicity awaiting an unmarried mother in charge of a large city and hunkered down with the challenges of early parenthood. (The baby’s name and gender were first disclosed through anonymous sources.)

In a city where brash elected leaders have often drawn attention to themselves — sometimes from federal prosecutors — Bowser has prided herself on a technocratic leadership style and survived her first term without a crippling scandal. With no real opposition in November, she is all but certain to become the city’s first mayor to win reelection since the early 2000s.

Bowser insisted Friday afternoon that she had not stepped out of character by challenging the president, but “thought it was important to make sure that the facts were out there” about the parade’s costs.

“I don’t want to be a Twitter celebrity,” she said.

By then she had little choice.

“The local politicians who run Washington, D.C. (poorly) know a windfall when they see it. When asked to give us a price for holding a great celebratory military parade, they wanted a number so ridiculously high that I cancelled it,” Trump wrote at 7:57 a.m.

Bowser’s response, retweeted more than 25,000 times by Friday evening, drew widespread praise, and some attacks, on social media. Amid a few ripostes from Trump supporters about the District’s rates of crime and homelessness, the mayor’s account was deluged with hand-clap emojis, laudatory GIFs and even suggestions of a 2020 presidential run.

Some, in an apparent tribute to the mayor’s toughness, posted images of the Nintendo character who shares her name — a formidable, spiky-shelled turtle monster who seeks to conquer the Mushroom Kingdom in the Super Mario Bros. franchise.

Other District politicians followed suit. Phil Mendelson — the D.C. Council’s punctilious, Ford Focus-driving chairman, whose political battles have included disputes with his colleagues over typos in the city budget — tweeted a humorous GIF of a man looking surprised, accompanied by the text, “REALLY, Mr. Trump?!”

In response to the president’s allegation that the city is poorly run, John Falcicchio, the mayor’s chief of staff, tweeted what must stand as one of the few successful jokes since the advent of social media about municipal bonds, posting a link to news last month that the city’s credit is being upgraded.

“When they go low, we go high,” he wrote. “Like our bond rating.”

Such taunts found a welcoming audience in the District, where just 4.1 percent of voters supported Trump in 2016.

“The council and the mayor have been risk-averse for years,” said longtime D.C. political consultant Chuck Thies. “But there’s no risk here. Taking on the president for a parade that probably wouldn’t be very popular locally — there’s no risk, you’re preaching to the choir, and you’re setting yourself up for a parade of high fives.”

But for some in the District who have criticized the mayor for not standing up to the Trump administration in other areas, Friday’s uncharacteristically colorful gesture seemed an empty one.

Labor organizer and D.C. Democratic State Committee member Todd Brogan said the mayor’s tweet would not make up for what he said was her inaction in the face of U.S. Immigration and Customs Enforcement raids targeting D.C. residents. Some Latino and immigrant-rights activists have criticized the mayor for not defending the District’s status as a “sanctuary city” more forcefully.

“Trump effectively gave the best in-kind contribution to the Bowser campaign anybody could give,” Brogan said. “It’s great political theater. . . . Now she gets to go champion herself on a national stage as this great resister to Trump.”

Bowser said she and other D.C. officials have championed initiatives to counteract harmful Trump administration policies, such as a legal-defense fund for immigrants and legislation that restored locally the Affordable Care Act’s individual mandate to buy health insurance after it was eliminated.

D.C. Council member Charles Allen (D-Ward 6) said he began crafting a caustic tweet responding to the president this morning but abandoned the effort after reading what the mayor wrote and deciding he couldn’t improve on it.

He said criticisms of Bowser for engaging in political theater rang hollow when considered next to the provocation she was responding to.

“If someone’s criticizing the mayor, saying, ‘Oh, you made a political tweet,’ ” he said, “how on earth do you not look at what the president is doing?”