Image copyright Getty Images Image caption A drag performer dances in front of Westboro church members at the Supreme Court in 2013, as the justices prepared to hear arguments on gay marriage

Pastor Fred Phelps, head of the Westboro Baptist Church, is dead at age 84. Despite being widely disavowed, his shock slogan, 'God hates fags', made headlines around the world. How did he come up with the infamous message?

The Westboro Baptist Church has been holding services since 1955, but didn't turn its attention to homosexuality until about 20 years ago.

Until then, Fred Phelps was known more for his civil rights work - and his nuisance lawsuits - than for his anti-gay activism.

But those who monitored Phelps say the focus on sexuality was always a part of his message.

"Phelps was obsessed with human sexuality for his entire life, going back six decades," says Mark Potok, a senior fellow at the Southern Poverty Law Center.

He notes that Phelps was profiled in Time magazine in 1952 because he had a street ministry against petting and dirty jokes.

It wasn't until 1991 that the modern movement began to form.

Image caption Phelps, shown with his wife and some of his signs, in 2007

"Locally, the church is near a park in Topeka, Kansas, called Gage park," says Fred Mann, a reporter for the Wichita Eagle, who has written about Phelps in the past.

"They believed there was homosexual activity in the park. They went with signs, anti-gay signs and then it spread from there."

At first, the "God hates fags" slogan was nowhere to be found.

"I remember them talking about the beginning days of the picketing," says filmmaker K Ryan Jones.

His film Fallen From Grace followed Phelps and the Westboro Baptist Church for a year.

He recalls that they told him: "Originally our signs did just say 'gay' or 'homosexual' or that kind of thing, and then we started using 'God Hates Fags'."

They set out to shock - and they knew that those who weren't offended by the use of the word "fag" would bristle at the idea of God hating anyone, says Jones.

Their tactics seemed to work. Though "God hates fags" is not their only sign, it is one of the best-known and the one most associated with the church.

The signs also provided a pithy explanation of the church's theology, which is explained in greater depth on their website, GodHatesFags.com.

"'God loves everyone' is straight from the mind of Satan and his ministers that serve him," it says.

"In essence 'God loves everyone' means that man can lead a sinful life, violate the commandments of God daily, not fear Him and still go to heaven."

The site provides a detailed chart of everyone in the Bible it says have been killed by God's wrath.

Image copyright Getty Images Image caption Westboro Baptist Church members protest outside the funeral of conservative reverend Jerry Falwell in 2007

The sharpness of their message combined with their antics at the protests created an intense reaction.

"There's a lot of people that do not like homosexuality, but they would never use that kind of language," says Mann.

"It was their behaviour on the picket line that appalled people. They didn't just show up with signs, they danced and sang. They were delighted to be at someone's funeral."

And the more the church members upset and outraged onlookers, the more validation they felt.

Counter signs The Westboro protests were often met with counter-protests, many featuring signs mocking Phelps' message of hate, including: God hates figs

God hates signs

God hates flags

God hates fags (with a picture of a cigarette)

"When they are attacked, that to them is proof positive that they are delivering the true message of God," says Jones, as the Bible says that Christians spreading the Gospel will meet with persecution.

Phelps and his family first began to receive national attention when they picketed the funeral of Matthew Shepard, the gay college student who was beaten and left to die in a field near Laramie, Wyoming.

But they became much more notorious when they began in around 2005 to picket the funerals of soldiers who died in the Iraq war.

"That's when they went from being nationally known to globally known," says Potok, thanks in part to the bluntness of their message and the seeming mismatch between the signs and the targets of their protests.

Image copyright AFP/Getty Images Image caption As Westboro protested more soldiers' funerals, motorcyclists organised the Patriot Guard to block the signs, seen here in 2006

"It's hard for people to understand," says Jones, "because they see signs that say things like 'Thank God for Dead Soldiers' and 'Thank God for 9/11'.

"And these soldiers weren't gay. Not everyone in 9/11 was gay.

"Any tragedy you can think of, they believe that is God's wrath on America because of our tolerance of homosexuality.

"It's evidence of the message they are trying to promote."

As the family and their message grew in prominence, so did the signs themselves.

At first, says Jones, the signs were a fairly do-it-yourself affair, made of magic markers and poster board.

Now, he says, they have an industrial printer, a professional laminating machine and an entire workshop devoted to making signs.

The Phelpses also proved adept at social media, creating Vine videos that attracted attention from news sites that would normally criticise the Westboro message.

Image copyright AP Photo Image caption The protests were not always well attended - this one in 1999 had only 15 people. But the signs attracted outsized attention.

In the end, their shock message was so well-known and their methods so loathed that they didn't even have to protest.

"At least half the time they would call up a place they were going to picket ahead of time," says Potok.

When news leaked that the Phelpses were going to be at Sandy Hook, for instance, it spurred international media attention - but the family never showed.

"They wouldn't bother," says Jones. "They already got what they wanted."

Though Phelps is dead, his church remains, with many more members to carry out his theology and carry his signs.

But the power of 'God Hates Fags' has become so strong that the signs - or even the protesters - are hardly necessary any more.

Follow @BBCNewsMagazine on Twitter and on Facebook