KANSAS CITY, Kan. (AP) — A federal judge in Kansas has ruled that a law making it a crime to "encourage" or "induce" immigrants to enter or live in the country illegally is unconstitutional.

KCUR-FM reports that U.S. District Judge Carlos Murguia issued his ruling from the bench Wednesday before throwing out the convictions of Jose Felipe Hernandez-Calvillo and Mauro Papalotzi. Prosecutors said the men, who themselves are in the country illegally, managed crews of workers who installed drywall for a Lawrence company.

After they were convicted of conspiring with supervisors to violate the law, the Ninth U.S. Circuit Court of Appeals in San Francisco ruled in a similar case that encouraging immigrants to be in the country illegally is protected speech under the First Amendment.

Kansas isn't governed by the Ninth Circuit, but Murguia found the argument persuasive. He said in his ruling that he was adopting the Ninth Circuit court's analysis "in full" and agreed that the law is "overbroad." Four others who also were charged in 2016 with violating the law, including the company's owner, pleaded guilty in 2017 to misdemeanors.

The law was passed by Congress in 1952 and has been amended several times since then. Violations carry a sentence of up to five years in prison, with another five tacked on if the defendant acted for "commercial advantage or private financial gain."

"The important thing, other than the First Amendment issue, is that the government was using this (law) to charge people who did nothing more than make a job available to an undocumented person, whether or not they had direct knowledge that the person was undocumented," said Hernandez-Calvillo's attorney, Tom Bradshaw.

"The statute requires that when you 'encourage' or 'induce,' you know the person was here illegally. But the government has played loose with that."

Jim Cross, a spokesman for the U.S. Attorney for the District of Kansas, said in an email that his office "is evaluating the judge's ruling at this time" and had not made a decision about its next step. If prosecutors appeal, that sets up the potential for the 10th U.S. Circuit Court of Appeals, which covers Kansas, to overturn Murguia's ruling. That would create a conflict between two federal circuits, setting the stage for a possible Supreme Court decision to resolve the issue.

The two men whose convictions Murguia threw out could still be deported, although the government has not initiated deportation proceedings against them. Bradshaw said his client is raising a son who was born in the U.S. and just graduated from high school.