WASHINGTON — In a First Amendment clash over a law barring offensive trademarks, the Supreme Court on Wednesday raised doubts about a government program that favors some forms of speech but rejects others that might disparage certain groups.

The justices heard arguments in a dispute involving an Asian-American band called the Slants that was denied a trademark because the U.S. Patent and Trademark office said the name is offensive to Asians. Justice Elena Kagan reflected the concerns of several justices when she said government programs are not supposed to make a distinction based on viewpoint.

“The point is that I can say good things about something, but I can’t say bad things about something,” she said. “And I would have thought that that was a fairly classic case of viewpoint discrimination.”

The Oregon-based band says the 70-year-old law violates free-speech rights. A federal appeals court had ruled that the law is unconstitutional, but the government appealed.

A victory for the band would be welcome news for the Washington Redskins, who are embroiled in their own legal fight over the team’s name. The trademark office canceled the football team’s lucrative trademarks in 2014 after finding the word “Redskins” is disparaging to Native Americans.

But the justices also seemed concerned that imposing absolutely no limits on trademark names might go too far.

At issue is a law that prohibits registration of marks that “may disparage ... persons, living or dead, institutions, beliefs or national symbols.” A trademark confers certain legal benefits, including the power to sue competitors that infringe upon the trademark.

Slants founder Simon Tam says his goal was to reclaim a derisive slur and transform it into a badge of ethnic pride. But the trademark office said a term can be disparaging even when used in a positive light. A federal appeals court sided with the band, ruling that the law violates the First Amendment.

The Obama administration wants the high court to overturn that ruling.