Fox News senior judicial analyst Judge Andrew Napolitano told “Fox & Friends” on Thursday that “consent” determines whether the deployment of federal agents to Chicago and other cities to help combat rising rates of crime is constitutional.

“The essence here is consent,” Napolitano said.

“If the state officials or local officials consent to the introduction of federal assets on the streets and for law enforcement purposes there is no constitutional impediment,” he explained. “But if they don't consent, then there is a constitutional impediment.”

President Trump announced on Wednesday that he is deploying 100 federal agents to Chicago – a move that marks an expansion of the White House’s intervention into local law enforcement as Trump continues to position himself as the “law and order” president.

The "surge" of agents to Chicago and other American cities is part of Operation Legend – named after 4-year-old LeGend Taliferro, who was fatally shot while sleeping in a Kansas City apartment late last month – and comes as federal law enforcement officers have already descended on Portland, Ore. and Kansas City, Mo.

“The effort to shut down police in their own communities has led to a shocking explosion of shootings, killing, violence, murders,” Trump said during a speech in the White House’s East Room. “This rampage of violence shocks the conscience of our nation and we will not stand by and watch it happen.”

“It's important to stress the operations we are talking about are the standard anticrime fighting activities we have been carrying out around the country for decades,” Attorney General Bill Barr said on Wednesday. “We will be adding federal agents to the task forces… They will be working shoulder to shoulder with our state and local colleagues.”

“This is a different kind of operation obviously than the tactical teams we use to defend against riots and mob violence and we are going to continue to confront mob violence,” Barr added.

Napolitano explained why "consent" is the "essence," pointing to the late Justice Antonin Scalia's opinion on the topic.

“If the feds force the state to spend money or use their state assets in ways they don't want to do, that violates the concept of federalism,” Napolitano said. “Federalism is the area of regulatory authority that the states retained when they join the union and health and safety are among them.”

He went on to provide Chicago as an example.

“If Mayor[Lori] Lightfoot says to the attorney general or the president, ‘Yes, I want your guys to work arm in arm, shoulder to shoulder, as the attorney general said, with my people, but I don't want them getting in people's faces, I don't want them enforcing local laws, I want them to work with my people.’ There is nothing wrong with that,” Napolitano said.

“But if they work on their own and she doesn't want them there, under the Constitution they have to go.”

Chicago, which is currently experiencing a spat of deadly gun violence, has been a particular target of Trump’s criticism. A shooting at a funeral home earlier this week left 14 people injured, and followed a weekend that saw 10 people killed and 60 people injured due to gun violence.

PORTLAND BANS POLICE FROM WORKING WITH FEDERAL LAW ENFORCEMENT

“At least 414 people have been murdered in the city this year,” Trump said. “These are numbers that are not even to be believed.”

In a letter signed by 16 mayors, including, Portland Mayor Ted Wheeler, calling on Trump to reverse his orders, Lightfoot said, “We welcome partnership, not dictatorship, and will never tolerate the kind of unconstitutional deployment and state-sanctioned lawlessness we saw in Portland.”

Host Steve Doocy noted that “the president of the United States and the attorney general have every right in the world to go ahead and order in federal agents to protect federal assets” in Portland according to the law, “if the local law enforcement under the direction of the mayor there will not protect federal facilities.”

Napolitano agreed, saying: “They have every right to do so and they would be derelict if they didn't do so.”

“Portland is a unique situation and it’s very sad. In fact, it's condemnable because you have a mayor and city officials that have handcuffed the police and so innocent life and valuable property has been harmed as a result of that,” Napolitano said. “I don't know what those people can do. They need to throw the mayor out.”

Mayor Wheeler has consistently demanded that President Trump remove federal agents deployed to the city amid criticisms of a heavy-handed response against protesters and journalists and reports that militarized law enforcement personnel have refused to identify themselves. Wheeler even said that the federal agents are escalating the violence in Portland.

“As [Thomas] Jefferson said, when the government systematically and repeatedly assaults your rights or refuses to protect them, it's time for the people to alter or abolish the government,” Napolitano said.

“That is not the case or doesn't appear to be the case in Chicago or in other states where the president has actually spoken with mayors before deciding to send people in.”

CLICK HERE TO GET THE FOX NEWS APP

He went on to explain that “if the federal assets are in Portland, just to defend federal property, they have every right to do so but, if they are there to intimidate or affect the protesters, they don't have a right to do it. In fact, they have to protect the protesters, not push them back.”

Fox News’ Andrew O’Reilly and The Associated Press contributed to this report.