President Obama on Monday signed into law the latest version of the Stolen Valor Act, which makes it a federal crime for people to pass themselves off as war heroes by wearing medals they didn't rightfully earn.

The legislation passed both houses of Congress with overwhelming majorities.

An earlier version, passed in 2005, was struck down in June 2012 when the Supreme Court ruled that lying about military heroics was constitutionally protected speech unless there was intent to gain some benefit or something of value by fraud.

The law signed Monday at the White House includes such a provision, making it illegal to make the claims with the intent to obtain money, property or other tangible benefits.

Veterans organizations were quick to applaud Congress and the President for acting quickly on the amended version of the law.

"I think this was necessary because people were using it to receive the benefits of decorations of valor, and they were getting monetary benefit from it," said John Stovall, director of national security and foreign relations for The American Legion. "That's why we supported the amended version, not to infringe on anyone's First Amendment rights but to protect the reputation and meaning of the decorations."

The 2005 law made its way to the Supreme Court after a California man challenged his conviction and $5,000 fine for unlawfully claiming to be a Medal of Honor recipient. The court declared the law unconstitutional unless the fabricator intended to get something of value by making the claims.

William "Bill" Hillar of Maryland spent years claiming to have been a Special Forces soldier with expertise in human trafficking and counter-terrorism. Colleges and universities paid him to teach classes, and law enforcement organizations paid to hear his presentations.

But the charge that got Hillar sentenced to 21 months in federal prison was wire fraud, not the 2005 Stolen Valor Act. Among Hillar's claims was that he went on a one-man search for a daughter kidnapped and sold into slavery; the story was the basis for the Liam Neeson film "Taken."

He was arrested finally in Jan. 2011 after his scam was exposed by veterans through the website ProfessionalSoldiers.com.

The Stolen Valor Act of 2013 was introduced into the House by Rep. Joe Heck, R-Nev., who has said the awards, like the men and women who earned them, are worthy of respect.

Other lawmakers shared Heck's sentiment. "I'm very happy the President signed the Stolen Valor Act," said Rep. Paul Cook, R-Calif., a retired Marine colonel. "The new law ensures that we protect and honor veterans and the sacrifices they've made. When people make false claims of military rank and heroism, it does a tremendous disservice not only to our vets, but to the public."