NEW YORK (CBSNewYork/AP)Mayor Bill de Blasio canceled an opportunity to meet with President Donald Trump at the White House in a dispute over immigration.

READ MORE: Crowds Flock To Rockefeller Center Christmas Tree Lighting: 'Always Been Magical'

City Hall previously said de Blasio would be among a group of mayors sitting down with President Donald Trump to discuss infrastructure, which is a major issue in New York City and the Tri-State Area, given the region’s transit problems and its aging roads and bridges.

However, the mayor said on Twitter that he had decided not to go.

“I will NOT be attending today’s meeting at the White House after @realDonaldTrump’s Department of Justice decided to renew their racist assault on our immigrant communities. It doesn’t make us safer and it violates America’s core values,” he wrote.

As CBS2 Political Reporter Marcia Kramer reported, the mayor spoke about his decision at a news conference later in the afternoon.

“I came down here ready to have a serious meeting. And what I got was a publicity stunt from the Trump administration. And this just proves, once again, that they’re not trying to work with American cities,” de Blasio said. “It’s astounding me that this opportunity was undermined by the president and his administration.”

De Blasio added, speaking of Trump: “Here’s what he did to a group of mayors. He said, ‘Come over to my house, but I’m going to take your wallet while you’re there.’”

The stated purpose of the meeting had been for mayors to make their voices heard about the need for federal infrastructure dollars, but de Blasio dismissed that description as a ruse.

“I was shocked,” de Blasio said. “It made no sense that this was happening, and immediately believed it suggested the whole thing was a charade.”

Trump spoke out about the decision by some to not attend, saying those mayors are placing the needs of illegal immigrants above citizens.

“We can’t have it,” Trump said. “We want a safe country.”

The White House said it was disappointed that “a number of mayors have chosen to make a political stunt instead of participating in an important discussion.”

The Justice Department sent letters Wednesday to two dozen so-called sanctuary cities, demanding that they turn over documents showing they aren’t withholding information about the immigration status of people in custody.

READ MORE: Jacqueline Avant, Wife Of Music Executive Clarence Avant, Found Shot To Death In Beverly Hills Home Invasion

Web Extra: Read the Justice Department’s letter to sanctuary cities.

“We would love to be able to work with these mayors, particularly on issues like infrastructure and other things, but we cannot allow people to pick and choose what laws they want to follow,” said White House Press Secretary Sarah Huckabee Sanders. “If we have a country with no laws, then nothing matters.”

President Trump also spoke out about the decision by some to not attend, saying those mayors are placing the needs of illegal immigrants above citizens.

“My administration is committed to protecting innocent Americans, and the mayors who choose to boycott this event have put the needs of criminal illegal immigrants over law-abiding Americans,” Trump said. “But let me tell you, the vast majority of people showed up, OK, the vast majority — because the vast majority believe in safety for your city.”

The mayor started tweeting even before he landed in Washington, saying the Trump administration’s move violates America’s core principles.

Many mayors went to the White House to meet the president anyway, but some also decided to support de Blasio.

“One thing that we never do is invite people into a comfortable space, and then somehow out in the front go throw a bomb so that the conversation starts off in a negative way, rather than a positive way,” said New Orleans Mayor Mitch Landrieu.

Chicago Mayor Rahm Emanuel also decided not to go to the White House session, CBS Chicago reported. Responding to the Justice Department letter, Emanuel also said Chicago and other cities rely on community policing strategies to build trust and help fight crime.

“You cannot do that if you drive a wedge between any immigrant community and the law enforcement. It is contrary to public safety, it’s contrary to the values of our nation, and it’s contrary to the ideals and the law as we established,” he said.

Since New York City has many needs in addition to immigration, Kramer asked the mayor about New York City’s infrastructure problems, including decaying subways, roads and bridges and the need for a new tunnel under the Hudson River.

Kramer: “Mr. Mayor, I wonder if you think you could accomplish for New York City by being inside the tent than outside the tent.”

De Blasio: “Obviously, Marcia, whenever there’s a real dialogue, you want to be in the room trying to have an impact on the polices, but this clearly was not going to be a real dialogue.”

Sounding off on social media, there were mixed reactions to the mayor’s decision.

De Blasio previously met with Trump just over a week after the 2016 election to talk with the then-president-elect about “the concerns and the needs of all New Yorkers,” saying that many “were fearful.”

De Blasio said he told Trump at the time that he was representing the people’s’ views on immigration, stop-and-frisk, and income inequality.

During the 2016 campaign, Trump dumped all over the mayor, calling him a “disaster” and saying he was doing a “horrible job.”

MORE NEWS: First U.S. Case Of Omicron Variant Detected In California

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)