Democratic presidential candidate and New York City Mayor Bill De Blasio, right, tours the POET Biorefinery plant with former agriculture secretary Tom Vilsack during a campaign stop on Friday in Iowa. (Scott Olson/Getty Images)

Within minutes of New York Mayor Bill de Blasio declaring his presidential bid Thursday, President Trump attacked him. For once, both Trump’s allies and his target were fine with it.

De Blasio, a lanky liberal who runs the city that Trump long called home, provoked two tweets from the president as well as a video shot from Air Force One — an unusual amount of attention for a 2020 entrant who hasn’t dented the polls. For the mayor and his allies, it was seen as essentially an in-kind contribution from the president, giving his nascent campaign more oxygen and drawing a contrast with a president deeply unpopular among the Democratic base.

And for the president, it was the perfect opportunity to slash a mayor who is seen by the president’s supporters as the epitome of a big-city liberal. Overall, it was an old-fashioned tabloid-style brawl between two longtime New Yorkers.

“It’s good for both of them. It’s pathetic for both of them that they have this mutually beneficial relationship, but they do,” said Stu Loeser, a prominent New York consultant who was an aide to former mayor Michael Bloomberg. “No one who is thinking of supporting Trump likes Bill de Blasio, and no one who is thinking of supporting Bill de Blasio likes Trump.”

Advisers say Trump does not regard de Blasio as a serious threat — seeing him as more of a useful foil — but that he still keeps up with the city, reading The New York Post in the White House residence each morning.

Trump has focused much of his attention so far on former vice president Joe Biden and on Sen. Bernie Sanders (I-Vt.), who have done well in the polls. In a meeting with supporters at the White House this week, Trump asked if they saw any other Democrat beating Biden or Sanders, adding that he thought it was unlikely. His campaign’s own polling shows Biden beating him at this point, advisers say.

But de Blasio quickly joined the target list. On Thursday, Trump tweeted that “if you like high taxes & crime, he’s your man. NYC HATES HIM!” White House aides say Trump made the video because he was flying to New York and was bored on Air Force One. 

“I just heard that the worst mayor in the history of New York City, and without question, the worst mayor in the United States, is now running for president,” Trump says in the video. “It will never happen.”

De Blasio advisers say he will launch a “full frontal” attack on Trump, hoping to draw him into substantive fights, and that they were thrilled that he engaged. In his announcement video, de Blasio suggested it would take one tough New Yorker to battle another.

“I’m a New Yorker. I’ve known Trump’s a bully for a long time,” de Blasio said in the video. “This is not news to me or anyone else here, and I know how to take him on.”

Still, de Blasio may struggle for attention in a field of 23 Democrats that includes Biden and seven sitting senators. But supporters say the field is without a successful liberal executive, and that de Blasio will challenge the president on the environment, immigration and health care while calling Trump a con man and highlighting his pockmarked history as a New York businessman. 

Even before de Blasio’s announcement, the spat took on the trappings of a New York City tabloid battle.

The mayor on Monday held a news conference at Trump Tower to criticize the Trump Organization’s failure to cut emissions. That prompted a back-and-forth on Twitter that included Eric Trump, the president’s son, opining that “our great city has gone to s--- under your leadership.”

He wasn’t the only family member to get in on the scrap. Donald Trump Jr. tweeted a video Wednesday that appeared to show trash lining a New York City street, writing that instead of running for president, de Blasio “should clean up his backyard first.”

Trump and de Blasio barely know each other, associates say. They had an hour-long meeting in Trump Tower during the presidential transition, and people close to de Blasio said he was surprised that the president was complimentary. They briefly discussed immigration and policing, but the conversation was not followed by a second one. 

On the night Trump won the election, de Blasio was celebrating at the Manhattan apartment of liberal donor George Soros, people familiar with the matter said. 

The two men have some similarities, though both might recoil at that notion. Both love to attack the press. Both were seen as outsiders with little chance at winning their races. Both are unpopular in New York and think people outside the city will see them more favorably. Neither plunges deeply into minutiae they run, and both have supreme self-confidence, according to people close to them. 

Whether de Blasio can take on Trump on remains unclear. His news conference in the lobby of Trump Tower was overshadowed by protesters and loud music blaring from the building. People close to him question whether his preferred nickname, “Don Con,” will work against Trump and have warned against it. Many of those closest to de Blasio, even supporters who think he is a good mayor, decided not to engage in the race because they did not think he would win. 

Trump’s team wants to paint de Blasio as a mayor who made New York City worse, though the city’s economy is strong and crime is low.

“I doubt anyone was sitting around saying, ‘You know what this Democrat field needs? A little Bill de Blasio!’” said Tim Murtaugh, a spokesman for the Trump campaign. “He adds yet another dose of socialism to the field and brings to the table a disastrous time as mayor of New York.” 

One thing is certain, people close to both men say: The New Yorkers are likely to keep talking about each other. As the president’s motorcade rolled to the airport Friday, campaign manager Brad Parscale complained about the potholes in the city streets and blamed de Blasio. 

“He’s a con man,” de Blasio said while campaigning in Iowa on Friday. “He told working people in Iowa, in rural areas, that he was going to be on their side. And he socked them with tariffs.”