Boston Mayor Marty Walsh is holding firm on protecting unauthorized immigrants, despite a federal appeals court ruling that allows the Trump administration to hold back some federal dollars from so-called sanctuary states and cities like Boston.

The decision, handed down Wednesday by the Second Circuit Court of Appeals in New York, allows the Justice Department to withhold law enforcement grants to sanctuary jurisdictions that do not fully cooperate with federal immigration agents.

Walsh vowed at an event in Boston Wednesday evening that the city will "absolutely not" alter its policies because of the ruling.

“The police department of Boston represents Boston and they work in Boston. We’re not federal authorities. There’s federal authorities that do that work with ICE,” he told reporters.

The mayor recently signed amendments to the city’s Trust Act detailing how and when Boston Police are to cooperate with U.S. Customs and Immigration Enforcement.

“If we know a person in the city that’s extremely dangerous, we will do the proper work to make sure that person’s off the street," he said. "But if we have somebody who’s just undocumented and lives somewhere and works somewhere, that’s not the police’s job to go find that person and arrest them."

Wednesday’s ruling undid a lower court’s decision in favor of New York City and seven states — including Massachusetts — that sued the federal government after the Justice Department announced it would withhold law enforcement grant funds until the jurisdictions comply with ICE demands for cooperation.

Walsh, making a rare appearance at an evening workshop on neighborhood planning in Mattapan hosted by the Boston Planning and Development Agency, said the the department's new policy is wrong.

“You shouldn’t govern by whether or not cities are opening to immigrants,” he said, pointing to Boston’s foreign-born population. “You’re only hurting the residents and the taxpayers in those cities by not giving money down from the federal government.”

On Thursday, Massachusetts Attorney General Maura Healey told WGBH News that her office is still reviewing the court’s decision. But that the Trump administration’s policies toward so-called “Sanctuary” communities has hampered law enforcement efforts here.

“My priority is public safety and what I fear is this is another action by the Trump administration that actually harms public safety, harms law enforcement,” Healey said.

She also said the Trump administration’s vilification of Sanctuary communities is counter-productive to law enforcement goals.

“When you scare people and you drive them underground, they’re less likely to cooperate in our investigations, whether it’s drug trafficking or human trafficking,” Healey said. “And they’re less likely to report crimes to us.”