SMITHFIELD, R.I. — A Rhode Island judge has blocked a town’s attempt to go beyond state law by creating a stricter medical marijuana ordinance.

Superior Court Judge Richard Licht issued a preliminary injunction Wednesday that prevents Smithfield from enforcing an amendment to its zoning ordinance that restricts the cultivation and distribution of medical marijuana.

The town in April passed a law that limits the number of plants a licensed grower can have to two. Under state law, growers are allowed to have 12 plants.

The American Civil Liberties Union of Rhode Island filed a lawsuit in June, arguing the ordinance infringes on patients’ rights as guaranteed by state law.

Officials have said the ordinance is a way to prevent excessive marijuana sales.

The council’s president didn’t immediately respond to a request for comment.