An appeals court Friday agreed with a lower court's ruling upholding a Nebraska law requiring picketers to stay at least 500 feet from funerals — the latest decision in a yearslong legal dispute that could end up before the U.S. Supreme Court.

The U.S. 8th Circuit Court of Appeals said that all speakers, including members of Westboro Baptist Church, have a constitutionally protected right to express their beliefs at funerals. But the appeals court also said those rights "are not absolute and some time, place, and/or manner restrictions are allowed" to protect the privacy rights of funeral mourners.

Shirley Phelps-Roper, a prominent member of the Topeka, Kansas, based church, sued in 2009. She argued, among other things, that the Nebraska law is selectively enforced.

The church protests at funerals throughout the country using anti-gay chants and signs because it believes God is punishing the U.S. for defending a nation that tolerates homosexuality.

At trial in 2015, church members testified that they are often kept much farther from funeral services than counter-protesters. The church argued on appeal that the Patriot Guard Riders and others groups that have served as a "buffer" between Westboro Baptist members and funeral attendees were allowed to get as close as they wanted to a 2011 service for a military service member.

But the appeals court agreed with the lower court that church members failed on that assertion.

"The PGR and other attendees were, as invitees, a part of the funeral itself, and thus they did not engage in 'protest activities' within the meaning of the statute," the appeals court said.

Nebraska Attorney General Doug Peterson applauded Friday's ruling.

"This law strikes the appropriate balance between first amendment free speech rights and the rights of grieving families to bury their loved ones in peace," Peterson said in a written statement.

An attorney for and member of the church, Margie Phelps, said the decision will not stop the group from picketing funerals and that the church will likely appeal.

"There's a considerable likelihood that we'll go have a visit with the Supreme Court," Phelps said. "There's a fundamental principal here that is being neglected, and that is: In this country, simply because you don't like the words, you don't take a speaker on a public issue away from their target audience."