In Portland, Washington and other U.S. cities shaken by protests in recent months, the Trump administration has leaned on the considerable authority and assets of the Department of Homeland Security — an agency formed to prevent another Sept. 11, 2001, attack — to spearhead the federal response.

Images of militarized Border Patrol agents clubbing protesters and stuffing them into unmarked vehicles have alarmed civil liberties advocates and administration critics, and the displays of government power echo tactics long associated with authoritarian rule.

Legal analysts say that while the department has broad authority to enforce federal laws, officers’ actions — especially in Portland, Ore. — seemed to be pushing the boundaries and pulling DHS into a domestic policing role.

“There’s a line that it certainly looks like they’ve crossed. And, if I may, it’s an important line because it’s the difference between federal law enforcement and a roving commission where you’re using these law enforcement officers to go out and restore what they deem to be order,” said Stephen I. Vladeck, a law professor at the University of Texas at Austin.

DHS officials defended their tactics in Portland again Tuesday, saying the department has an obligation to protect government buildings in the city that have been targeted for more than 50 consecutive nights by black-clad protesters shooting fireworks, lobbing projectiles and attempting to set alight the federal courthouse.

Chad Wolf, the acting DHS secretary, said federal agents are not deployed widely across the city and described the situation there as “unique,” blaming local officials who have eschewed cooperation with the Trump administration.

DHS agents have been deployed “to protect a symbol of justice — the courthouse,” Wolf said. “We mostly do that in a very defensive posture. However, we have been forced because of a lack of local enforcement presence to take measures, such as arrests, to protect our officials.”

Over the weekend, demonstrators pulled down a fence, employed radio frequency jammers, attempted to set the courthouse on fire and used slingshots to hurl ball bearings and batteries at federal agents, Justice Department spokesperson Kerri Kupec said Tuesday.

While DHS and Justice officials have strained to depict their actions in Portland as isolated, emergency measures, President Trump has undermined that message with statements linking “chaos” in the city to a surge in violent crime in Chicago, New York and elsewhere.

Struggling in the polls and beset by multiple crises, Trump has been eager to more widely deploy DHS personnel he views as loyal to “dominate” U.S. cities as he campaigns for reelection as an urban lawman.

The president has exercised federal power primarily through DHS and its subagencies, including U.S. Customs and Border Protection (CBP) and Immigration and Customs Enforcement, where several top political appointees lack Senate confirmation but appear almost daily on cable television to praise Trump’s resolve.

At the center of his strategy is a willingness to deploy U.S. border and immigration enforcement agents on American streets, relying on agents who are accustomed to operating at airports and border crossings where they are generally subject to fewer constraints than ordinary police officers. The fact that many of those officers are not accustomed to dealing with urban unrest, analysts said, is also problematic.

“It increases the danger both for the law enforcement officers and for the civilian population when you have law enforcement agents who are not trained in a particular duty being asked to perform that duty,” said Jonathan Meyer, a former DHS lawyer now in private practice at Sheppard Mullin.

Those specialized teams are among the most “heavily militarized” components in federal law enforcement, normally assigned to “engage in low-grade warfare against heavily armed narco-terrorists,” said Paul Rosenzweig, a former DHS official who now works as a senior fellow at the R Street Institute.

“I think it is not illegal, but it is an expansion of mission and what I would characterize as a misapplication of authority,” Rosenzweig said. “So make it lawful but awful.”

Trump has signaled that he intends to increase the federal law enforcement presence in other cities run by Democrats — drawing pushback from local mayors who say they will not welcome it.

In the coming days, two administration officials said, the Justice Department is expected to announce an expansion of its “Operation Legend,” an initiative to surge federal agents from the FBI, U.S. Marshals Service, Drug Enforcement Administration and the Bureau of Alcohol, Tobacco, Firearms and Explosives, to Kansas City, Mo., to help address a spike in violent crime. That operation, officials said, is distinct from the efforts in Portland, which have largely been focused on courthouse protection and civil unrest. The officials spoke on the condition of anonymity to discuss law enforcement deployments that have not yet been made public.

One of the cities to which federal authorities will deploy is Chicago, according to an official familiar with the matter; that city’s mayor, Lori Lightfoot, has expressed concern over the plan because of what happened in Portland.

DHS officials familiar with the Chicago preparations say it will include about 150 ICE agents from the Homeland Security Investigations divisions, which target drug networks, human trafficking and transnational crime. The HSI agents will not be deployed in an urban policing role, officials say, and will instead help target gang members and others driving the crime increase.

Legal analysts said the department is well within its legal authority to surge federal agents in cities — even to places that don’t want them.

“Federal law enforcement is not a by-invitation-only exercise,” said Jonathan Turley, a constitutional expert and criminal defense attorney who represented journalists and legal observers arrested as part of a mass roundup during demonstrations in D.C. in 2002.

DHS officials have also expanded their abilities to gather intelligence on protesters who may be targeting federal monuments and statues, according to a memo that surfaced this week. DHS officials say they are relying on open-source social media posts to find whether violent actors are planning to show up.

Trump’s eagerness to leverage DHS powers and “send in the feds” has brought a backlash that increasingly includes Republicans wary of an expanded federal role on American streets.

Tom Ridge, the former Pennsylvania governor who served as the country’s first homeland security secretary under George W. Bush, said during an interview Tuesday with broadcaster Michael Smerconish that DHS was established to protect the country “from the ever-present threat of global terrorism.”

“It was not established to be the president’s personal militia,” Ridge said.

“It would be a cold day in hell before I would consent to a unilateral, uninvited intervention into one of my cities,” he added, “and I wish the president would take a more collaborative approach toward fighting this lawlessness than the unilateral approach he’s taken.”

The federal government’s power is not unlimited, legal analysts said. Federal agents can only investigate and enforce federal crimes, though that gives them the ability to go after gang and drug activity or other crimes involving the crossing of state lines. They can help enforce state laws if state or local authorities give them the authority to do so — which is common on task forces with state and federal law enforcement agencies, analysts said.

If state or local officials seek to pull back that power, analysts said, it might hamper federal law enforcement’s effectiveness.

“The problem with Operation Legend is that it can only fully function with the cooperation of local law enforcement,” Turley said. “The federal government has no authority to enforce local, criminal laws.”

Trump’s response to the unrest is partly an outgrowth of the border crisis he faced in 2018 and 2019, when record numbers of Central American families and children crossed into the United States and overwhelmed U.S. agents. Trump responded by deploying U.S. troops and tightening immigration laws, while heaping praise on Border Patrol agents and ICE personnel.

Some of the DHS officers’ recent tactics have generated controversy, including their wearing of uniforms that sometimes do not clearly note their identity or which agency they work for, and their use of unmarked vans. Legal analysts, though, said such tactics — while possibly objectionable — are legal and commonplace.

“Police use unmarked cars regularly to conduct arrests,” Turley said.

DHS has also stirred controversy by sending CBP drones to track protests from the sky, but officials said the agency regularly uses surveillance aircraft to monitor large gatherings that could be a target for terrorist attacks, including sporting events.