WASHINGTON—The Justice Department is quietly exploring new legal theories to take on so-called sanctuary cities in court, working to force them to aid the Trump administration’s aggressive deportation effort, people familiar with the discussion said.

Such a case, if filed, would significantly escalate the Trump administration’s pressure campaign against recalcitrant cities and counties.

The administration has already threatened to cut off federal funding to cities and counties that refuse to facilitate deportations, and it has sought to “shame” jurisdictions that don’t cooperate. If successful, the new court efforts would compel local authorities to assist federal immigration officers whether they want to or not.

Separately, on Friday the Justice Department filed papers in support of the state of Texas’ defense in federal court of one of the toughest anti-illegal immigration laws in the nation. The statute, which is set to take effect in September, prohibits Texas cities and police departments from limiting their cooperation with federal immigration authorities.

Under that law, local Texas law-enforcement officials and sheriffs can face criminal penalties—including jail sentences—if they don’t comply with requests from federal authorities to detain suspected illegal immigrants until they can be transferred to Immigration and Customs Enforcement custody.