A federal appeals court has tossed out parts of a law that would punish those who would knowingly encourage immigrants to come to, or remain, in the U.S. illegally.

A three-judge panel of the San Francisco-based 9th Circuit concluded the federal law unconstitutionally bans a range of protected speech.

The Justice Department prosecuted a San Jose woman who ran an immigration consulting firm, for allegedly helping arrange green cards for those working in the country illegally.

The judges concluded the law’s reach was overbroad.

“We do not think that any reasonable reading of the statute can exclude speech. To conclude otherwise, we would have to say that ‘encourage’ does not mean encourage, and that a person cannot ‘induce’ another with words. At the very least, it is clear that the statute potentially criminalizes the simple words – spoken to a son, a wife, a parent, a friend, a neighbor, a coworker, a student, a client – ‘I encourage you to stay here,'” the opinion said. “The statute thus criminalizes a substantial amount of constitutionally-protected expression. The burden on First Amendment rights is intolerable when compared to the statute’s legitimate sweep.”

The law would make it punishable if someone “encourages or induces an alien to come to, enter, or reside in the United States” if the encourager knew, or recklessly disregarded “the fact that such coming to, entry, or residence is or will be in violation of law.”

There was no immediate response to the decision from the Justice Department.