CONCORD — The New Hampshire Civil Liberties Union and three voters, including a state representative and a man who voted for his dead dog because he didn’t approve of the candidates, are challenging a new law that bans ballot photos being posted to social media or shared with anyone.

The law makes publishing someone’s marked ballot a violation punishable by a $1,000 fine.

The lawsuit, filed Friday in federal court in Concord, seeks an order barring the state from enforcing the law, which took effect Sept. 1. It says the three voters are under investigation by the state attorney general’s office after taking digital photos of their completed primary ballots and posting them to social media.

Assistant Attorney General Stephen LaBonte said Friday he is still reviewing the lawsuit “and we’ll respond to the court.”

Proponents of the law, including the Secretary of the State’s Office, say it is intended to deter vote buying and voter coercion.

Rep. Mary Till, a Derry Democrat and member of the House Election Law Committee, testified that anyone wishing to coerce voters could insist on seeing pictures of their ballots “to prove that they voted the way they were told to vote.”

NHCLU staff attorney Gilles Bissonnette said the law attempts to gag political speech protected by the First Amendment.

“The First Amendment does not allow the state to, as it is doing here, broadly ban innocent political speech with the hope that such a sweeping ban will address underlying criminal conduct,” Bissonnette said.

One of the plaintiffs, Andrew Langlois, of Berlin, wrote in the name of his dead dog, Akira, as his choice for the Republican U.S. Senate candidate and posted his ballot on Facebook. He said he wasn’t satisfied with the official candidates.

Rep. Leon Rideout, a Lancaster Republican running for re-election, and Brandon Ross, a Manchester lawyer seeking his first term as a state representative, took photos of their ballots and posted them on social media. Both remain on the ballot in the general election.

Ross said Friday that he didn’t immediately post his marked ballot because he mistakenly believed that doing so was a misdemeanor. He said he didn’t immediately realize the penalty had been reduced to a violation before the final votes were taken by lawmakers. He said he posted his ballot on Facebook several weeks after the primary, when he learned that others were being investigated.

Under his Facebook post, he wrote, “Come at me, bro.”

“It’s still a thousand dollars that I don’t have,” Ross said, “but some things are worth it to me, and this is one of them.”