Immigration and Customs Enforcement (ICE) suffered a legal blow recently after a federal judge ruled the agency's so-called "knock-and-talk" tactics, which involve engaging illegal immigrants and other migrants subject to arrest, to be unconstitutional.

California U.S. District Judge Otis Wright II, a President George W. Bush appointee, issued a motion for summary judgment in favor of the plaintiffs last week in a class action lawsuit brought against Homeland Security Secretary Alejandro Mayorkas in his official capacity.

The case, Kidd v. Mayorkas, arose from a 2018 run-in between an immigration agent and an immigrant in the U.S. on temporary protective status named Osny Sorto-Vasquez Kidd. The agent reportedly approached Kidd's Los Angeles-area home with a photo purported to be of a "dangerous man out to get" them, Kidd said at the time, according to the Orange County Register.

However, by the end of the encounter, Kidd was arrested and sent to a San Bernardino, California, detention facility. 

BORDER RANCHER RECORDS 3,000 IMAGES OF ILLEGAL IMMIGRANTS

The class action suit was filed on behalf of Kidd, the Inland Coalition for Immigrant Justice and the Coalition for Humane Immigrant Rights, according to Lexis Nexis.

Wright ruled that ICE officers were violating the Fourth Amendment by using knock-and-talks as a means to lure people they sought to arrest outside their homes. He said the tactic remains legal in situations involving criminal arrest warrants.

Since deportation orders fall within civil jurisdiction, agents conducting them do not have the same authority to enter a suspect's property as officers executing a criminal arrest warrant, the judge concluded.

TRUMP DECLARES BORDER A WAR ZONE, DINGS NEWSOM FOR ‘TERRIBLE JOB’

"Considering the policies and practices governing how ICE conducts its ‘knock and talks,’ the more accurate title for certain law enforcement operations would be ‘knock and arrests’" Wright wrote. "This order serves to vacate those unlawful policies and practices."

Wright's ruling cited an ICE handbook, which instructs that a "warrant for arrest of [an] alien nor a warrant of removal authorizes officers to enter the target’s residence or anywhere else where the target has a reasonable expectation of privacy. A government intrusion into an area where a person has a reasonable expectation of privacy for the purpose of gathering information will trigger Fourth Amendment protections, including a physical intrusion into a constitutionally protected area."

CLICK HERE TO GET THE FOX NEWS APP

US Immigration and Customs Enforcements (ICE) special agent

A U.S. Immigration and Customs Enforcement special agent is seen in Ohio on June 19, 2018. (ICE / U.S. Immigration and Customs Enforcement.)

He said officers must clearly obtain voluntary consent to enter property where reasonable privacy is expected.

However, one noted critic, former immigration Judge Matthew O'Brien, told the Washington Times on Wednesday that Wright got the law wrong.

"It’s absurd to say that ICE can’t engage in investigative procedures," O'Brien told the outlet.

Fox News Digital has reached out to ICE and DHS for comment.