Image caption Westboro Baptist Church has staged protests at the funerals of soldiers killed in Iraq and Afghanistan

The US Supreme Court has ruled an anti-gay church has the right to picket military funerals under the US constitution's free speech protections.

The court ruled 8-1 for the Westboro Baptist Church, throwing out an earlier $5m (£3m) judgement awarded to the father of a fallen US Marine.

Members carried signs denouncing the US for its tolerance of homosexuality.

Chief Justice John Roberts wrote church members' speech cannot be limited "simply because it is upsetting".

'Inflicting great pain'

"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, and that protection cannot be overcome by a jury finding that the picketing was outrageous," Justice Roberts wrote on Wednesday for the court.

Church members, led by the Reverend Fred Phelps, have picketed outside numerous military funerals to draw attention to their view that US military deaths in Iraq and Afghanistan are punishment for the immorality of Americans, including tolerance of homosexuality and abortion.

The only way for a different ruling is to shred the First Amendment Margie Phelps, Lawyer for Westboro Baptist Church

"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," Justice Roberts wrote.

"On the facts before us, we cannot react to that pain by punishing the speaker. 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."

Lance Cpl Matthew Snyder was killed in a Humvee accident in Iraq in 2006 and his body was returned to the US state of Maryland.

Members of the Westboro Baptist Church travelled from their base in Kansas to the funeral site, alerted local police of their planned protest and picketed peacefully, on public land, in accordance with police guidance.

For about 30 minutes before the funeral began, the protesters marched with signs reading: "Thank God for Dead Soldiers", "You're Going to Hell" and "God Hates the USA/Thank God for 9/11".

Mr Snyder saw only the tops of the group's signs, according to the court record, but saw what was written on them on a television news broadcast later that evening.

He then filed a lawsuit in March 2006, accusing the church of intentionally inflicting emotional distress and won $11m at trial in 2007, later reduced by a judge to $5m.

A federal appeals court in Virginia threw out the judgement, saying the constitution shielded the church members from liability. The Supreme Court on Wednesday agreed.

'Vicious verbal assault'

In a dissent, Justice Samuel Alito wrote the First Amendment to the constitution does not grant the right intentionally to inflict emotional distress on private figures.

"Our profound national commitment to free and open debate is not a licence for the vicious verbal assault that occurred in this case," he wrote.

"In order to have a society in which public issues can be openly and vigorously debated, it is not necessary to allow the brutalisation of innocent victims."

Following the ruling on Wednesday, Margie Phelps, Mr Phelps's daughter and the lawyer representing the church, told reporters that the case "put a megaphone to the mouth of this little church".

"We read the law. We follow the law. The only way for a different ruling is to shred the First Amendment," she added.