The Supreme Court ruled Wednesday that under the First Amendment a controversial church is allowed to protest at military funerals.

In an 8-1 ruling, the Supreme Court ruled in the case of Snyder v. Phelps that the Westboro Baptist Church can wage anti-gay protests at military funerals under the First Amendment. The decision, written by Chief Justice John Roberts, upholds the ruling of an appeals court, which rejected a prior ruling that church members were not allowed to protest gay rights at the funeral of a Marine. Justice Samuel Alito was the dissenting opinion and Justice Stephen Breyer concurred the court's decision.

"On the facts before us, we cannot react to that pain by punishing the speaker," Roberts wrote in the decision. "As a Nation we have chosen a different course — to protect even hurtful speech on public issues to ensure that we do not stifle public debate. That choice requires that we shield Westboro from tort liability for its picketing in this case."

The Kansas-based Westboro Baptist Church has gained wide attention and criticism for picketing military funerals with signs featuring homophobic slurs.  

Read the ruling below:

SCOTUS decision on Westboro Baptist Church