WASHINGTON — The Supreme Court on Monday struck down a federal law barring the registration of “immoral” or “scandalous” trademarks, saying it ran afoul of the First Amendment.

The court also made it harder for news organizations and the public to obtain commercial information under the Freedom of Information Act.

The trademark case concerned a line of clothing sold under the brand name FUCT. When the case was argued in April, a government lawyer told the justices that the term was “the equivalent of the past participle form of the paradigmatic profane word in our culture.”

Justice Elena Kagan, writing for a six-justice majority, did not dispute that. But she said the law was unconstitutional because it “disfavors certain ideas.”