Whether you're one of the estimated 130,000 Massachusetts residents who voted early, or you're waiting to cast your ballot on Nov. 8, you probably see voting as an important way to participate in our democracy. Maybe you even want to show your enthusiasm for your candidate-of-choice by taking a selfie with your ballot—but is it legal?

Justin Timberlake made headlines this week when he posted a photo of himself in his Tennessee polling station and authorities there initially said that they would investigate the singer for violating a state election law. Though officials now say no such investigation is underway, the action prompted conversations about the legality of so-called "ballot selfies" in states across the country. 

Brian McNiff, communications director for Secretary of the Commonwealth William F. Galvin, said that there is a statute in Massachusetts making the practice illegal.

"It has nothing to do with selfies, the law just says you cannot make copies or representations of a completed ballot," McNiff said.

McNiff noted that a recent court decision by the U.S. Court of Appeals First Circuit makes that law difficult to enforce when it comes to taking a picture with your ballot. McNiff also added that "There are rules about how long you can stay in a polling station."

The appellate court recently ruled that a New Hampshire law prohibiting ballot selfies is unconstitutional, saying that there is a First Amendment right to do so. Because the First Circuit appellate court covers multiple districts, including Massachusetts, the ruling extends to residents of the Commonwealth as well, said Matthew Segal, legal director of the ACLU of Massachusetts.

"It's very unlikely that this law prohibiting ballot selfies in Massachusetts could survive a court challenge," he said. 

With the New Hampshire case, Segal said, the court examined whether the state had a "plague" of vote buying or intimidation that could justify such a law.

RELATED: Want to vote early in Boston? Here's how

"That's one of the theories," he said. "If you can show people how you voted than it will be possible for people to buy your vote or intimidate you into voting a certain way, because then they can check to see if you voted the way they wanted you to."

That wasn't the case in New Hampshire, the appellate judges found. Segal said he isn't aware of a market for vote buying or a trend toward voter intimidation in Massachusetts that would be stopped by a law that prevented ballot selfies. 

"The court is saying... is it appropriate to completely ban an activity that is protected by the First Amendment and not only that, but is a celebration of a democratic action," he said. 

Segal said he thinks that's why most people choose to snap a pic while in the polling booth: because they're truly excited about voting. He said it's important for people to understand that this is protected by the First Amendment and that public officials and law enforcement officers trying to enforce this Massachusetts law could be sued. 

"Some people do it because they want to show that they're participating in our democracy, some do it to show support for a particular candidate," he said. "So there are a lot of really good reasons why people would choose to exercise this right."

Still, McNiff said that the Commonwealth's Elections Division doesn't encourage it.