Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

For many young voters, especially first-timers, casting a ballot is a rewarding act of participation in American democracy.

Time to take a photo to document the moment and post it on social media.

But beware: taking a voting selfie is illegal in at least half the states and could result in a hefty fine.

On Tuesday, the First Circuit Court of Appeals in Boston considered whether banning selfies in the voting booth is a violation of free expression or legitimate way to combat fraud.

It's the first time a federal appeals court considered the issue.

Snapchat is among the groups pushing for an end to the bans, calling ballot selfies an important way for young voters to "participate in the political process and make their voices heard."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

At issue is a 2014 New Hampshire law that makes it a crime, punishable by a fine of up to $1,000, for voters to take pictures of their ballots and share them on social media. Enforcement of the law was blocked a year ago by a federal judge, and the state appealed.

People vote in the Super Tuesday primary on March 1, 2016. Paul J. Richards / AFP/Getty Images

Lawyers for the state say the law was passed to protect the purity and integrity of its elections by thwarting anyone who would try to buy or sell votes or threaten to harm someone who voted the wrong way.

"You're free to go out into the community and scream at the top of your lungs how you voted and who you support in the election. You just can't use your marked ballot to do so," said Stephen LaBonte, an attorney representing New Hampshire.

Vote buying was rampant in the 1800's, the state says, especially when the political parties printed the ballots, with a different color for each party. That made it easy for spotters at the polls to tell how people were voting.

And the state says its law does nothing to prevent voters from using social media or any other forum to talk or write about how they voted.

The law was challenged by three New Hampshire residents who took selfies as they voted — including a state representative and a man who didn't like any of the candidates for U.S. Senate and wrote in the name of his dog who had died a few days earlier.

Putting a voting booth selfie on the Internet "is a powerful form of political speech that conveys various constitutionally protected messages that have no relationship to vote buying or voter coercion," says Gilles Bissonnette of the American Civil Liberties Union of New Hampshire, representing the challengers.

Voters head to the polling booths inside Bedford High school on Feb. 9, 2016 in Bedford, New Hampshire. The Washington Post / The Washington Post/Getty Images

The state cannot point to a single instance of vote buying since the late 1800's and admits it has not received any complaints about a voter selfie being used in such a scheme, Bissonette said.

"This law would ban an 18-year-old, newly minted voter from posting a photograph of her ballot, expressing pride in having voted for the first time," Bissonette said.

A year ago, a federal court blocked enforcement of a similar ban in Indiana. After officials there raised the same kind of concerns about vote buying, Federal District Court Judge Sarah Evans Barker called the law "a blunt instrument designed to remedy a so-far undetected problem."

Only nine states appear to either explicitly allow ballot selfies or have no currently enforceable state law clearly forbidding it. Those states are Arizona, Delaware, Indiana, Maine, New Hampshire, North Dakota, Oregon, Utah, and Wyoming.

Most of the states, 26, explicitly ban it through various laws, including prohibitions on bringing cameras into polling places.

The law is unclear in Arkansas, Connecticut, Hawaii, Idaho, Illinois, Kansas, Kentucky, Maryland, Minnesota, New Jersey, Ohio, Rhode Island, Vermont, and Washington.