The Supreme Court ruled Wednesday that the First Amendment protects fundamentalist church members who mount attention-getting, anti-gay protests outside military funerals.

The court voted 8-1 in favor of the Westboro Baptist Church of Topeka, Kan. The decision upheld an appeals court ruling that threw out a $5 million judgment to the father of a dead Marine who sued church members after they picketed his son's funeral.

Chief Justice John Roberts wrote the opinion for the court. Justice Samuel Alito dissented.

"What Westboro said, in the whole context of how and where it chose to say it, is entitled to 'special protection' under the First Amendment," Roberts wrote, "and that protection cannot be overcome by a jury finding that the picketing was outrageous."

Matthew Snyder died in Iraq in 2006 and his body was returned to the United States for burial. Members of the Westboro Baptist Church, who have picketed military funerals for several years, decided to protest outside the Westminster, Md., church where Snyder's funeral was to be held.

The Rev. Fred Phelps and other family members who make up most of the Westboro Baptist Church have picketed many military funerals in their quest to draw attention to their incendiary view that U.S. deaths in Afghanistan and Iraq are God's punishment for the nation's tolerance of homosexuality.