Tuesday's ruling from U.S. District Judge Jennifer L. Thurston also says Border Patrol agents can't stop people without having reasonable suspicion or return them to their countries of origin via "voluntary departure" unless that person is informed of their rights and agrees to leave.
The ruling only applies to people within the court's Eastern District of California, which includes Fresno, Bakersfield, Sacramento, and extends to the Oregon border.
RELATED: Trump admin takes immigration policies to Fresno federal court
Seventy-eight people were swept up in January after the Border Patrol launched an immigration enforcement action dubbed "Operation Return to Sender" in the Bakersfield area.
The American Civil Liberties Union sued Department of Homeland Security Secretary Kristi Noem and U.S. Border Patrol officials on behalf of the labor union United Farm Workers and people who were targeted during the Border Patrol raids.
The ACLU said border patrol agents spent nearly a week unconstitutionally detaining people who "appeared to be farmworkers or day laborers, regardless of their actual immigration status or individual circumstances." The detainees were bussed to the border, held without any way to contact family or attorneys, and coerced into signing papers that said they had waived their right to see an immigration judge and voluntarily agreed to leave the country, the ACLU said.
"The evidence before the Court is that Border Patrol agents under DHS authority engaged in conduct that violated well-established constitutional rights," Thurston wrote. She said the Border Patrol would have to provide a report showing exactly who is detained or arrested without warrants, and why, every 60 days until the lawsuit is concluded.
Attorneys for the Border Patrol had argued the judge lacked jurisdiction to consider the case because federal law says that immigration matters can generally only be appealed once an immigration judge has issued a final order.
Attorneys from the Justice Department told the judge in Fresno on Monday that the case should be "moot" and said placing conditions on immigration enforcement would "burden the government."
But Thurston said the Border Patrol can't claim the lawsuit is moot simply because it issued a new policy after it was sued. The language in the new policy isn't strong enough to guard against the illegal stops, Thurston said, and there is no reason to believe that the policy wouldn't be changed again in the future.
The judge's ruling against the government comes on the president's 100th day in office.
Rebecca Boone from the Associated Press contributed to this report.