SACRAMENTO, Calif. — California Gov. Jerry Brown on Tuesday signed a bill outlawing so-called revenge porn and levying possible jail time for people who post naked photos of their exes after bitter breakups.

Senate Bill 255, which takes effect immediately, makes it a misdemeanor to post identifiable nude pictures of someone else online without permission with the intent to cause emotional distress or humiliation. The penalty is up to six months in jail and a $1,000 fine.

“Until now, there was no tool for law enforcement to protect victims,” the bill’s author, Sen. Anthony Cannella, said in a statement. “Too many have had their lives upended because of an action of another that they trusted.”

Cannella, a Republican from Ceres, has said revenge porn is a growing problem in the age of social media, when photos and videos that were made privately during a relationship can find their way onto hundreds of websites.

Before the criminal law was enacted, California allowed victims to sue their virtual assailants, but that is an expensive and time-consuming option.

The American Civil Liberties Union had opposed the bill, arguing it might restrict free speech rights, which has been a concern in other states as well.

Florida lawmakers rejected a similar bill this year after First Amendment concerns surfaced there. Last year, the Missouri Supreme Court cited concerns about free speech in striking down part of a 2008 law enacted after a teenager who was teased online committed suicide.