WASHINGTON, D.C. — The Supreme Court on Monday struck down a longstanding U.S. ban on trademarks on "immoral" or "scandalous" words and symbols, ruling in a case involving a clothing brand with an indelicate name that the law violates constitutional free speech rights.

The justices ruled against President Donald Trump's administration, which defended the law that had been in place since 1905, and in favor of Los Angeles streetwear designer Erik Brunetti, who was turned down by U.S. Patent and Trademark Office when he sought to trademark his brand name FUCT.

All nine justices agreed in the decision written by liberal Justice Elena Kagan that the prohibition on "immoral" trademarks ran afoul of the U.S. Constitution's First Amendment right to free expression. However, three justices wrote dissents to say the bar on "scandalous" trademarks should have been upheld.

When the 2011 trademark application for FUCT was rejected, the Patent and Trademark Office noted that brand name sounds like a profanity though it is spelled differently, and concluded that Brunetti's products contained sexual imagery, misogyny and violence.

"There are a great many immoral and scandalous ideas in the world (even more than there are swear words)," Kagan wrote in Monday's decision, adding that the trademark law covers them all. "It therefore violates the First Amendment."

"Today is a good day for Americans," Brunetti's lawyer John Sommer said. "The U.S. Supreme Court has taken the government out of the business of deciding questions of morality."

The justices, who are due to wrap up their current term in the coming days with a handful of other major rulings on tap, upheld a 2017 lower court ruling striking down the law. The decision removes the authority of government officials to bar federal trademark registration for profane language or sexually graphic images.

The Trump administration had warned that invalidating the law would unleash a torrent of extreme words and sexually graphic images on the marketplace.