A federal judge on Thursday rejected a constitutional challenge to a New York state law barring voters from taking photographs of their marked ballots, known as "ballot selfies."

U.S. District Judge Kevin Castel in Manhattan also upheld the constitutionality of a New York City Board of Elections policy barring photography at city polling places.

Rejecting free speech challenges under the First Amendment, Castel said the state law was "narrowly tailored" to help thwart fraud and ensure the integrity of the election process, while the city policy was a reasonable means to limit delays at the ballot box.

The judge issued his 41-page decision one month after a two-day, non-jury trial.

"We fully expect to appeal," Leo Glickman, a lawyer for voters who challenged the restrictions, said in an email. "While the courts continue to expand First Amendment rights for wealthy and corporate interests, it is critical that we ensure that ordinary citizens maintain their First Amendment rights as well."

Amy Spitalnick, press secretary for New York Attorney General Eric Schneiderman, whose office defended the state law, declined to comment.

Nick Paolucci, a spokesman for New York City's law department, said the city was pleased with the decision.

U.S. states have long had constitutional or statutory provisions designed to ensure voting secrecy.

At the time the lawsuit was filed last October, New York had been one of 18 states restricting the taking of photographs in voting booths or of marked ballots.

Voters opposed to the state law said posting ballot selfies was an effective way to win support for particular candidates.

Government officials countered that the law reduced the risk of bribery and coercion, and that allowing photography would increase the time needed to vote, resulting in longer lines that could suppress turnout by less patient voters.

In his decision, Castel said that while ballot selfies were "incontrovertibly unique," the state law furthered New York's compelling interest in preventing vote buying and voter intimidation, and did not discriminate based on viewpoint.

"There is no doubt that a ballot selfie is a potent form of speech in that it sends a strong message that the individual in the photograph submitted the marked ballot depicted in the photograph," Castel wrote. "But other forms of visual display of candidate support may be as compelling or nearly as compelling without the attendant dangers."