California’s second attempt to ban federal immigration officers from concealing their faces with masks appears to be doomed under a new federal appeals court ruling.

The court also blocked a new California law requiring federal, state and local police to wear badges or other identification.

Citing the Constitution’s Supremacy Clause, which declares federal law to be “the supreme law of the land,” the 9th U.S. Circuit Court of Appeals said states may not enforce “a law that directly regulates federal operations even if the law regulates state operations in the same manner.”

By requiring federal officers to wear visible identification, California “purports to override the federal government’s power to determine whether, how, and when to publicly identify its officers,” Judge Mark Bennett wrote in a 3-0 ruling barring enforcement of the law, which had previously been upheld by a federal judge. “And in so doing, it aims to regulate the manner and conditions under which federal agents can enforce federal law.”

The law, written by Sen. Sasha Perez, D-Alhambra (Los Angeles County), requires all non-uniformed officers in the state to display identification, with a few exceptions such as undercover police.

Challenged in court by President Donald Trump’s administration, the law was allowed to take effect by U.S. District Judge Christina Snyder of Los Angeles.

But Snyder blocked enforcement of another law, SB627 by Sen. Scott Wiener, D-San Francisco, that would have barred local and federal officers – but not state police or California Highway Patrol officers – from wearing masks. She said the law discriminated against immigration agents and other federal police by allowing state officers to remain masked.

In response, Wiener has introduced SB1004, which would ban masks by state as well as federal officers. It’s not clear whether the bill would be signed by Gov. Gavin Newsom, who has opposed a mask ban for state police.

In October, the San Jose City Council passed a similar ordinance that prohibits all law enforcement officers in the city from wearing masks while on duty, except those needed for health or safety reasons.

But Wednesday’s ruling, if it stands, would appear to bar any such prohibitions for federal officers, even if they applied equally to state and local police.

“The Supremacy Clause does bar direct state regulation of the federal government,” said Bennett, who was appointed to the court by Trump. “And that is precisely what the No Vigilantes Act does,” he said, referring to the law written by Wiener.

Bennett was joined by Judges Daniel Collins, another Trump appointee, and Jacqueline Nguyen, appointed by President Barack Obama. Snyder, whose ruling they overturned, was appointed by President Bill Clinton.

Attorney General Rob Bonta, who defended SB805 in court, did not say whether he would ask the full appeals court for a new hearing before an 11-judge panel. Newsom, meanwhile, criticized the Trump administration for opposing California’s efforts to identify immigration officers who have been patrolling city streets in the state.

“These laws shouldn’t even be necessary,” Diana Crofts-Pelayo, a spokesperson for the governor, said in a statement. “We shouldn’t have unidentified, masked men terrorizing our communities.”

Wiener said Wednesday’s ruling “doesn’t directly impact” his new bill because the court had only barred enforcement of SB805 and has not issued a final ruling on its constitutionality. In the meantime, he said in a statement, “we will continue to push hard to make the changes Judge Snyder ruled would make California’s masking ban enforceable.”

Although the ruling was not a final decision on the law’s validity, the three-judge panel stressed that any attempt by a state “to directly regulate the United States in its performance of governmental functions,” such as law enforcement, would be unconstitutional.

Trump’s Justice Department did not immediately respond to a request for comment. But Bill Essayli, chief assistant U.S. attorney in Los Angeles and formerly the Trump-appointed U.S. attorney, called the ruling a “huge legal victory this morning in the Ninth Circuit, where the court permanently enjoined California’s unconstitutional mask law targeting federal agents.”

This article originally published at California’s second ICE mask ban attempt appears dead under new ruling.