Like most good stories, this one starts with a dog.

During the 2014 New Hampshire Republican primary, a voter decided he didn't like his options. So he wrote in the name of his recently deceased dog, snapped a pic of his ballot, and then posted it to social media.

Andrew Langlois got a notice a few days later from the New Hampshire secretary of state saying he was being investigated for breaking a law -- the ballot selfie law. 

Up until Tuesday, it was illegal in New Hampshire to take a photo of a ballot in the voting booth. But on Tuesday, a federal judge struck down the state's 2014 ballot selfie law on the grounds it limited free political speech. 

"What this law ignored, and what the court recognized, is that displaying a photograph of a marked ballot on the Internet is a powerful form of political speech that conveys various constitutionally protected messages,"  said Gilles Bissonnette, legal director of New Hampshire's ACLU branch, which sued on behalf of the dog's owner and a few other ballot selfie takers in the state.

How did we get to debating ballot selfies in the first place? Well, in 2014, the Republican-led legislature expanded on a 1979 law making it illegal for voters to share with someone their ballot with the intention of sharing how they'd vote. The legislature decided photos should be included in that, too. By banning photos, you couldn't prove how you voted, and thus you couldn't be bribed or coerced into voting a certain way.

U.S. District Court Judge Paul Barbadoro didn't buy that argument.

"[T]he Secretary has failed to identify a single instance anywhere in the United States in which a credible claim has been made that digital or photographic images of completed ballots have been used to facilitate vote buying or voter coercion," Barbadoro wrote.

New Hampshire is the only state in the country that recently enacted a ballot selfie law, according to Bissonnette. Many other states have laws that could be construed as banning ballot-box selfies, but those were enacted pre-Internet, and so far they really haven't been enforced. In fact, Bissonnette said there's almost a trend the other way: Maine, Oregon and Utah have recently repealed their ballot selfie laws. 

So next time you're in a polling booth and want to whip out your phone to take an artistic photo of your pencil on the ballot, or a selfie of you marking the ballot, or a picture of the "I Voted" sticker over the ballot -- all things I've considered doing -- know that it's probably OK.

[Editor's note: You're still taking a selfie -- which is very bad -- but you're also participating in democracy -- which is very good.]