A judge issued a temporary restraining order Friday that bars the Nobles County Sheriff's Office from using immigration documents to hold people in jail.

The American Civil Liberties Union sued Nobles County Sheriff Kent Wilkening earlier this year on behalf of four people who were kept in jail after they should have been released. Federal immigration authorities had requested those jail holds.

The U.S. Immigration and Customs Enforcement officers made their request using forms that they referred to as warrants, but the papers were not signed by a judge or magistrate and therefore were not valid, wrote Blue Earth County District Judge Gregory Anderson.

The injunction does not prevent the Sheriff's Office from communicating with federal officials, whether to notify ICE about anyone in jail and their expected release and court dates, or for other reasons, the judge wrote.

Nobles County has an agreement with immigration authorities to house and care for people who are in ICE custody, but the Sheriff's Office cannot perform the functions of an immigration officer.

"There does not exist within Minnesota statute the power for Minnesota peace officers to arrest a person for a federal civil offense at the request of ICE officers," the judge wrote.

The county said Friday that it plans to appeal.

The Associated Press contributed to this report.