(Damian Dovarganes/AP)

California Gov. Jerry Brown (D) on Tuesday signed into law a measure that protects the right to leave bad reviews online.

The bill bans businesses from forcing consumers into contracts in which they waive their right to comment on the service they receive, and it also bars businesses from otherwise penalizing customers for such statements. It imposes fines of $2,500 for the first violation and $5,000 for each thereafter. If a violation was willful, intentional or reckless, an additional fine of $10,000 could be levied.

The law was inspired by the experience of a Utah couple whose credit rating was damaged after a business demanded a penalty for a negative review they posted, the bill’s sponsor, then-Speaker John A. Pérez (D) said in introducing it this spring.

“Most of us assume we have just as many rights after making a purchase as we did before,” he said in a statement at the time. “If a merchant thinks our First Amendment free speech rights need to be curtailed, they should say so, up front, and in plain language.”

The online review site Yelp and others have pursued similar protections in other states and at the federal level with measures aimed at protecting consumers from strategic lawsuits against public participation, known as SLAPPs. Such lawsuits may claim that a consumer’s comments on a blog or review site defamed the business, its owner or employees and come with steep fines. Anti-SLAPP advocates say the lawsuits are intended to stifle free speech.

Anti-SLAPP laws have been passed in 28 states and D.C., according to the Digital Media Law Project. Many of the laws were passed in recent years. California already had provisions protecting consumers from such lawsuits. The law was among more than a dozen signed on Tuesday by Brown.