TOPEKA, Kan. — The Rev. Fred Phelps Sr., the virulently anti-gay preacher who drew wide, scornful attention for staging demonstrations at military funerals as a way to proclaim his belief that God was punishing America for its tolerance of homosexuality, died late Wednesday. He was 84.

The Westboro Baptist Church confirmed the death, declaring on one of its websites, “Fred W. Phelps Sr. has gone the way of all flesh.”

The church did not give a cause of death, but Phelps had been living under hospice care.

Phelps, who founded and led Westboro, a small nondenominational church in Topeka, was a much-loathed figure at the fringe of the U.S. religious scene, denounced across the theological and political spectrum for his beliefs, his language and his tactics.

His congregation, which claims to have staged thousands of demonstrations, is made up almost entirely of family members, many of whom lived together in a compound in Topeka, although some of his children and grandchildren have broken with the group.

A disbarred civil-rights lawyer who once had been honored by the NAACP and who ran for office repeatedly, and unsuccessfully, as a Democrat, Phelps seemed to accept the criticism if not relish it.

He believed that the United States was beyond saving and he devoted his life to traveling with a small band of protesters to highlight what he saw as America’s sinfulness and damnation. His church’s website maintains a running tally of “people whom God has cast into hell since you loaded this page.”

Fred Waldron Phelps was born on Nov. 13, 1929, in Meridian, Miss. He said that he had been admitted to the U.S. Military Academy but that after high school he had what his official biography called “a profound religious experience” and decided instead to pursue a Christian higher education, first at Bob Jones College in Tennessee and then, when the institution moved, at Bob Jones University in South Carolina. He did not graduate.

He devoted himself to evangelism, and in 1951, when he was 21, he was profiled in Time magazine because his denunciations of “promiscuous petting” and “teachers’ filthy jokes in classrooms” on a California college campus had brought him into conflict with the administration.

He married Margie Marie Simms in 1952, and in 1954 the couple moved to Topeka. They had 13 children, 54 grandchildren and seven great-grandchildren, according to the church’s website. Phelps established Westboro Baptist in 1955.