In a seeming act of defiance toward the Trump administration, a federal judge in San Francisco has refused to reinstate the president’s sanctuary cities order.

The bold move to not reinstate President Donald Trump's executive order -- which sought to slash funding to cities that limit cooperation with federal immigration authorities -- comes amid a battle between the State Department and local governments across the country over the edict from Washington.

The U.S. Department of Justice had asked U.S. District Court Judge William Orrick to reverse his own injunction in April against Trump's executive order. The injunction was issued in response to lawsuits by San Francisco and Santa Clara County in California.

Attorney General Jeff Sessions wrote a memo in May saying the executive order should be applied narrowly to a small number of grants and to very specific violations of immigration law. The memo said cities that "willfully refuse to comply" with federal law could lose grants from the Justice and Homeland Security departments, but not other federal funding.

The Justice Department said the memo negated the need for Orrick's injunction.

Orrick said he found Sessions' memo unconvincing, asserting it would allow the attorney general to reverse his stand at any moment.

The judge's injunction stops enforcement of the executive order across the country, and allows the lawsuits to go forward.

And Orrick's refusal to reverse it strikes another blow to Trump's attempt to punish cities that give safe haven to those in the country illegally.

On Friday, Sessions is scheduled to visit Philadelphia, where officials have said its local law enforcement will not act as immigration agents — a stance Sessions has challenged as unconstitutional.

During a speech to law enforcement officials in Las Vegas, Sessions recently singled out Philadelphia, saying the City of Brotherly Love is "advertising" its policy and "protecting criminals."

Sessions' trip comes on the heels of a New York Times interview published this week in which Trump expressed frustration with Sessions for recusing himself from the FBI probe into Russian influence on the 2016 U.S. presidential election.

The Associated Press contributed reporting to this story.