The Supreme Court on Thursday struck down a federal law that made it a crime to lie about having received military medals.

The Stolen Valor Act of 2005 makes it a crime to falsely claim to have been awarded military honors and decorations. It imposes increased penalties for lying about certain awards, including the Medal of Honor.

But in the Supreme Court’s 6-3 decision, Justice Anthony M. Kennedy, who wrote the court’s opinion, said the act “would endorse government authority to compile a list of subjects about which false statements are punishable.”

Kennedy added that it might be possible to craft new legislation that could achieve the objective of the law “in less burdensome ways.”

Richard L. DeNoyer, commander in chief of the Veterans of Foreign Wars of the United States, said the organization “is greatly disappointed” in the decision.

“The VFW will continue to challenge far-fetched stories, and to publicize these false heroes to the broadest extent possible as a deterrent to others,” DeNoyer added.

The law was challenged by Xavier Alvarez, a former local elected official in California who falsely claimed he was a decorated war veteran. His attorneys argued that his lie was protected by the First Amendment’s guarantee of free speech.

Kennedy was joined in his opinion by Chief Justice John G. Roberts Jr. and justices Ruth Bader Ginsburg and Sonia Sotomayor. Justice Stephen G. Breyer, joined by Justice Elena Kagan, concurred in the judgment but filed a separate opinion.

Justice Samuel A. Alito Jr. filed a dissenting opinion, joined by justices Antonin Scalia and Clarence Thomas.