Now even Justin Timberlake has been forced to deal with the question of whether a ballot selfie is legal.

Timberlake flew from California to Tennessee to vote early this week, but his posting of an image of himself at the voting booth on Instagram on Monday drew questions about whether he was breaking the law.

A Tennessee law that took effect earlier this year bars voters from taking photographs or video while they’re inside a polling location.

While secrecy in the voting booth has become a thing of the past for those ready to share their views and daily lives on social media, laws nationwide are mixed on whether voters are allowed to take pictures of themselves voting and their ballots.

Federal courts have struck down bans in New Hampshire and Indiana, and on Monday, a judge in Michigan blocked enforcement of a ban on ballot selfies, saying it violates free speech.

Tennessee secretary of state spokesman Adam Ghassemi said officials are “thrilled Justin can’t stop the feeling” but reminded voters to use their phones inside polling locations only to help them vote.

Timberlake lives in California, but grew up in the Memphis area and owns property near Nashville.

How some states handle the question:

Some states where ballot selfies are illegal

Illinois: Banned by a law that considers “knowingly” marking your ballot so that another person can see it is a felony that carries a prison sentence of one to three years.

Florida: Photographs are not allowed in polling places or of mailed ballots.

Massachusetts: Taking a photo of a completed ballot in a polling location is banned in Massachusetts. But the state’s top election official, Secretary William Galvin, says there’s little the state can do to prevent it. Photos of mailed ballots are also banned.

New York: Photos showing a completed ballot or indicating how a person cast their vote are not allowed.

Wisconsin: State law prohibits sharing photos of ballots.

Some states where ballot selfies are allowed

District of Columbia: There’s no ban. Election officials discourage people from taking pictures but won’t do anything to stop them, said Tamara Robinson, a spokeswoman for the D.C. Board of Elections.

Indiana: A federal judge last year barred the state from enforcing a new law prohibiting ballot selfies.

Kentucky: Secretary of state spokesman Bradford Queen said state law does not allow people to record the likeness of a voter, but the law does not say whether voters can record their own likeness. Therefore, the secretary of state’s office routinely tells county clerks the law does not prohibit ballot selfies.

Michigan: A federal judge on Monday blocked enforcement of a ban on ballot selfies, saying it violates free speech. Lawyers for Secretary of State Ruth Johnson predicted “chaos” at polling places and asked the judge to consider freezing her order while they pursue an appeal in a higher court.

Minnesota: Allowed as long as they’re not shown to fellow voters at the polling place or capture another person in the photo.

New Hampshire: The 1st Circuit Court of Appeals in Boston last month upheld a decision that a ban was unconstitutional, saying it suppresses a large swath of political speech and there was no evidence to support the state’s concerns.

Some states where the legal status is mixed or unclear

Arizona: Bars photography within 75 feet of polling places. But the legislature changed the law that barred showing photos of completed ballots in 2015 to allow posting of early ballots on social media.

California: Gov. Jerry Brown signed a bill last month that repeals a 125-year-old law barring voters from showing people their marked ballots. The change will take effect nearly two months after the presidential election, but legislative analysts have found no occasion of the ban being enforced. The author of the bill, in fact, has been sharing constituents’ photos of marked ballots on social media since the law passed.

Iowa: Law prohibits the use of cameras, cellphones or other electronic devices in voting booths, so Secretary of State Paul Pate has asked voters not to take selfies with ballots. Photos of absentee ballots are OK.

Maryland: Bans electronic devices in a polling place except for the media. And even media members aren’t allowed to photograph a ballot that shows how someone is voting. But photos of mailed ballots are OK.

Missouri: Law prohibits voters from allowing others to see their ballots if the intent is to show how they voted. Secretary of state spokeswoman Stephanie Fleming described ballot selfies as a “gray area” and advises voters to check with local election authorities.

Ohio: Has a long-standing prohibition against voters letting their ballot be seen with the “apparent intention” of letting it be known how they are about to vote. The state elections chief has advised local election boards to consult their own attorneys about how to apply the law. Two Republican lawmakers are sponsoring a bill they say will let voters photograph and make public their marked ballots.

Pennsylvania: Law prohibits someone from revealing their ballot “letting it be known how” they’re “about to vote.” But officials recently released guidance on electronic items in polling places that noted the recent court cases that “found a First Amendment right to take ‘ballot selfies.’”

Texas: Bars photography within 100 feet of polling stations, so selfies are not allowed. Photos of mail-in ballots are OK.