On Thursday, a three-judge panel of the 9th Circuit Court of Appeals reversed an illegal immigrant’s deportation order, potentially having a big impact on how Immigration and Customs Enforcement (ICE) can apprehend illegal aliens in connection with search warrants.

The case of Gregoria Perez Cruz actually goes back 11 years. Cruz, according to the appeals court ruling, should not be deported although he was and remains an illegal immigrant.

In 2006 ICE received a tip that Micro Solutions Enterprises (MSE) in Van Nuys, California, was employing 200 to 300 illegals. In 2008, criminal complaints and arrest warrants were issued for employment-related documents and for eight MSE employees. The warrants were served upon MSE, a maker of printer cartridges, by approximately 100 ICE agents. Approximately 130 undocumented people were subsequently detained by ICE after those present were asked if they were legally in the country.

Internal ICE documents obtained via FOIA request by the ACLU of Southern California and the L.A. Chapter of the National Lawyers Guild showed that the MSE raid was planned from the beginning to result in the arrests of undocumented workers present at the factory. The documents showed that the agency’s expectation had been to detain and deport more than 200 factory workers.

The 9th Circuit panel order noted the documents showed “that ICE would have ‘2 buses and 5 vans’ ready to transport potential detainees from the factory and ‘200 detention beds available to support the operation.’”

Cruz, a citizen of Mexico, was among those detained and taken to a detention facility overnight. He was subsequently released. A month later he received a notice to appear for a removal hearing, charging him with “entry without inspection.”

In court proceedings, Perez’s legal team’s argument centered around the point that ICE agents acted outside their authority, given their search warrants for the company’s records and eight management employees.

An immigration judge later rescinded the agency’s deportation order, but then that decision was overturned by the Board of Immigration Appeals. Finally, the board’s decision led to the 9th Circuit Court ruling on Thursday.

“[The] search warrant here authorized a search only for the employer’s records — presumably, paper documents or electronic files. Yet, the agents used the warrant’s authority to enter the working area and detain hundreds of workers. Why a search for records required going onto the floor of a large printer-cartridge factory is unclear,” wrote Circuit Judge Marsha Berzon.

“ICE cannot carry out preplanned mass detentions, interrogations, and arrests that violate a person’s Fourth Amendment rights,” said Perez’s attorney Noemi Ramirez, as reported by The Associated Press. “This victory is not merely Mr. Perez’s victory, but a victory for people that value freedom, that believe the Constitution means what it says and for those that believe that the immigrant community is not alone in their struggle.”

Ramirez predicted that the 9th Circuit decision will affect how ICE conducts raids going forward.

Perez was represented by Ramirez and the American Civil Liberties Union.

The three judges on the panel were appointed by Democrats. Berzon and Senior District Judge Daniel Dominguez were chosen by Bill Clinton, and Circuit Judge Michelle Friedland by Barack Obama.