A Kansas church that attracted nationwide attention for its angry, anti-gay protests at the funerals of U.S. military members has won its appeal at the Supreme Court, an issue testing the competing constitutional rights of free speech and privacy.

The justices, by an 8-1 vote, said Wednesday that members of Westboro Baptist Church had a right to promote what they call a broad-based message on public matters such as wars. The father of a fallen Marine had sued the small church, saying those protests amounted to targeted harassment and an intentional infliction of emotional distress.

“Speech is powerful. It can stir people to action, move them to tears of both joy and sorrow, and — as it did here — inflict great pain. On the facts before us, we cannot react to that pain by punishing the speaker,” Chief Justice John Roberts wrote for the majority.