WASHINGTON — The Supreme Court has struck down a federal law making it a crime to lie about having received the Medal of Honor and other prized military awards.

The court voted 6-3 Thursday in favor of Xavier Alvarez, a former local elected official in California who falsely claimed he was a decorated war veteran.

Alvarez had pleaded guilty to violating a 2006 law that was adopted with the nation at war in Afghanistan and Iraq and aimed at people making phony claims of heroism in battle. The court, in a judgment written by Justice Anthony Kennedy, ordered that his conviction be thrown out.