The U.S. Supreme Court on Wednesday grappled over the legality of a Minnesota law barring people from wearing overtly political apparel at polling places, with some justices indicating it infringes on free speech rights and others worrying about voter intimidation.

The justices asked tough questions of both sides in an hour of arguments in an appeal by conservative activists of a lower court ruling upholding the law, which the state said is needed more than ever in the current polarized political environment to guard against Election Day arguments and violence at polling places.

Minnesota's law prohibits donning political badges, buttons or other insignia inside polling places during elections. State election officials have interpreted it as also barring campaign literature and material from groups with political views.

At least nine other states -- Delaware, Kansas, Montana, New Jersey, New York, Tennessee, Texas, Vermont and South Carolina -- have similar restrictions on political apparel at polling places, according to the plaintiffs.

The challengers, including the St. Paul-based Minnesota Voters Alliance and its executive director Andy Cilek, said merely wearing apparel such a T-shirts or buttons with political messages is an inherently peaceful form of expression. They argue that the law violates the guarantee of free speech under the U.S. Constitution's First Amendment.

Voters wearing such apparel are asked to cover up or remove offending items. If they do not, the may still vote, but their names are to be taken down for possible prosecution. The state said it has no record of any prosecutions under the law.

Minnesota said the law is applied neutrally and helps prevent confusion or intimidation during voting.

The law is similar to one in Tennessee, upheld by the Supreme Court in 1992, that bars the display or distribution of campaign materials and voter solicitation within 100 feet (30 meters) of a polling place, Minnesota noted in court papers.

The Minnesota Voters Alliance and several other organizations sued in 2010 claiming state officials turned polling places into "speech-free zones."

Cilek said he was twice turned away from his polling site that year for wearing a T-shirt touting the conservative Tea Party movement with the words "Don't Tread on Me" as well as a button stating "Please I.D. Me" that alluded to voter-identification laws backed by many Republicans. He eventually was allowed to vote.

The St. Louis-based 8th U.S. Circuit Court of Appeals upheld the Minnesota restrictions in 2013 and 2017.

The alliance is being represented by the Pacific Legal Foundation conservative advocacy group but also has the backing of the American Civil Liberties Union, which warned against giving poll workers discretion to decide what is impermissibly political.

(Reporting by Andrew Chung; Editing by Will Dunham)