Updated at 4:30 p.m. with Rawlings comments on Trump remarks.

WASHINGTON — Stung by a boycott from mayors nationwide over his latest crackdown on so-called "sanctuary cities," President Donald Trump on Wednesday blasted officials for shielding undocumented immigrants.

He also took potshots at Democrats before a bipartisan group of city leaders that included Dallas Mayor Mike Rawlings, who said later that he found Trump's comments divisive. Plano Mayor Harry LaRosiliere was among the mayors who joined a last-minute boycott, so he wasn't on hand as Trump insisted that cities that refuse to fully cooperate with federal immigration enforcement efforts put their citizens in danger.

"We can't have that," Trump said. "We want a safe country, and these sanctuary cities are the best friends of gangs and cartels like MS-13. ... The mayors who choose to boycott this event have put the needs of criminal illegal immigrants over law-abiding Americans."

The head of the U.S. Conference of Mayors, New Orleans Mayor Mitch Landrieu, announced a boycott shortly before the meeting with Trump, after the Justice Department threatened to subpoena records from 23 so-called "sanctuary cities," and to cut off their federal funds.

{"type":"video","title":"Dallas News Video","author_name":"Dallas News","_id":"lrdmI0ZTE6YWpaITRo4zDwtozHx0Pd5R","provider_name":"Ooyala","html":"

","raw":"{\"type\":\"video\",\"title\":\"Dallas News Video\",\"author_name\":\"Dallas News\",\"_id\":\"lrdmI0ZTE6YWpaITRo4zDwtozHx0Pd5R\",\"provider_name\":\"Ooyala\",\"html\":\"\\u003Cdiv class=\\\"oo-vid-container\\\" data-oo-content-id=\\\"lrdmI0ZTE6YWpaITRo4zDwtozHx0Pd5R\\\"\\u003E\\u003C\\/div\\u003E\\u003Cscript defer src=\\\"https:\\/\\/www.dallasnews.com\\/resources\\/motif\\/dist\\/js\\/ooyala.js\\\"\\u003E\\u003C\\/script\\u003E\"}","providerType":"ooyala","providerLink":"https://www.dallasnews.com/oembed","embedType":"video"}

The White House denounced the boycott as a "political stunt."

"It's a little hard for them to cancel a meeting that they did not organize," said White House spokeswoman Lindsay Walters. "This is a White House meeting."

Mayors from 11 Texas cities, including Fort Worth, Denton, Arlington, Carrollton and Plano, were on a list of expected attendees that the White House released before the meeting. No Texas cities were targeted by the Justice Department's threat Wednesday to issue subpoenas and cut off some federal funds.

Trump used the event to take shots at Democrats, asserting that their leadership has left cities in shambles. "For 100 years, the Democratic mayors have done a terrible — I mean, they've done some bad work," he said.

It was my great honor to welcome Mayor’s from across America to the WH. My Administration will always support local government - and listen to the leaders who know their communities best. Together, we will usher in a bold new era of Peace and Prosperity! https://t.co/dmYECTnk0a pic.twitter.com/RSv7V7r0DT — Donald J. Trump (@realDonaldTrump) January 24, 2018

He also reiterated support for a $1 trillion infrastructure plan, though its details left some mayors unimpressed: only 20 percent would come from Washington, with state and local governments expected to provide the rest.

Rawlings called the $1 trillion figure "misleading."

And he said, "I was obviously disappointed in how early he went partisan and criticized Democratic mayors. You'd never see that from Bush or from Obama."

Rawlings, who has led Dallas since 2011, was also irked by the attack on so-called "sanctuary cities," timed to an annual mayoral conclave in Washington. The term is "ill-defined" and politically loaded, he said, and cities accused of withholding cooperation actually do work closely with federal immigration authorities.

"That was on purpose, obviously. He led with that. That is a not a way that you unite people," the mayor said.

New York Mayor Bill de Blasio, whose city is a target of the crackdown announced earlier in the day by Attorney General Jeff Sessions, skipped the meeting with Trump, Vice President Mike Pence and senior officials. Chicago, Los Angeles, and the state of California were also targeted in what Trump called a "critical legal step to hold accountable sanctuary cities that violate federal law and free criminal aliens back into our communities."

The White House provided a list of 109 mayors expected to attend. Trump said he was "thrilled to welcome dozens" who did.

1 / 2President Donald Trump addresses mayors during a working session in the East Room of the White House Jan. 24, 2018.(Olivier Douliery / TNS) 2 / 2President Trump speaks to mayors at the White House on Jan. 24, 2018.(Manuel Balce Ceneta / AP)

Trump welcomed several mayors by name and asked them to stand, including Fort Worth's Betsy Price, who was there, and Mayor Toni Harp of New Haven, Conn., who wasn't.

The president then quipped that she might be a "sanctuary city person."

"I just felt that it was an inappropriate time to visit the president," Harp said afterward.

"Many mayors of both parties were looking forward to visiting the White House today to speak about infrastructure and other issues of pressing importance to the 82 percent of Americans who call cities home," Landrieu said in a statement announcing the mayors' boycott. "Unfortunately, the Trump administration's decision to threaten mayors and demonize immigrants yet again — and use cities as political props in the process — has made this meeting untenable."

"The U.S. Conference of Mayors is proud to be a bipartisan organization. But an attack on mayors who lead welcoming cities is an attack on everyone in our conference," he said.

LaRosliere, the Plano mayor, said by text that "key members of our USCM leadership team chose not to attend in light of the subpoena issued to a number of mayors regarding sanctuary cities and I chose to join them in their decision."

Garland Mayor Douglas Athas did attend. He said afterward that he "enjoyed his comments," especially Trump's report on an improving economy, and embrace of infrastructure investments, an important issue for North Texas.

Carrollton Mayor Kevin Falconer said he didn't find Trump at all divisive, and is eager to hear more about the infrastructure plan.

"He does have a commanding presence and he doesn't speak in normal political talk, but in some ways that was refreshing," he said.