Atheists, agnostics and others who don't believe in God can be barred from giving invocations at the Pennsylvania statehouse, a federal appeals court ruled Friday.

The decision by the 3rd Circuit Court of Appeals in Philadelphia upholds a state House of Representatives policy that its opening invocations may only be given by "a member of a regularly established church or religious organization” or a sitting member of the House.

In a split 2-to-1 ruling, the appeals court said the policy does not violate First Amendment rights because it fits within the “historical tradition of legislative prayer" and counts as government speech.

The “government speech doctrine” recognizes that a government entity “is entitled to say what it wishes” and to select the views that it wants to express.

The court ruling Friday noted that although the House rules "do not allow nontheists" to give the invocation, whoever gives the prayer "is told to craft a prayer 'respectful of all religious beliefs.'"

The decision reverses a lower court's ruling nearly a year ago that sided with the individuals and groups who sued over the House policy.

Americans United for Separation of Church and State slammed the ruling as indicative of a "troubling trend" that defies separation of church and state and allows "special privileges to people because they believe in a god."

In a disappointing ruling handed down on Friday, a federal appeals court said the Pennsylvania House of Representatives may limit opening invocations to theistic believers.https://t.co/2bxWiYfg4f — Americans United (@americansunited) August 26, 2019

The organization, which helped to represent the plaintiffs in the suit, pointed to Judge L. Felipe Restrepo's dissent to the ruling, which said that, "By mandating that all guest chaplains profess a belief in a ‘higher power’ or God, the Pennsylvania House fails to stay ‘neutral in matters of religious theory.'"

"The court buttressed its argument by pointing to 'historical practices,'" Americans United said in its statement. "This is blind to the reality of modern-day America where increasing numbers of people are declaring themselves 'nones' — individuals who seek spirituality outside the confines of a house or worship or discard religion entirely."

According to a recent survey data from the PEW Research Center, 29 percent of Americans identify as nonreligious. Ten percent do not believe in a higher power, while 9 percent don't believe in God, but believe in some sort of higher power.

Among the House's 678 legislative sessions over eight years, 575 began with a prayer, with 265 of those offered by guest chaplains, the lawsuit said.

Of those 265 invocations by guest chaplains, 238 were by Christian clergy, 23 by rabbis, three by Muslim imams, and one by a person who was not affiliated with a religion and gave a monotheistic prayer. The House welcomed its first Sikh guest chaplain in 2017.

In 2014, then-Speaker Sam Smith, a Republican, denied a request by a member of the Dillsburg Area Free Thinkers to give the invocation. Subsequently, the House changed its rules to say that the prayer must be given by "a member of a regularly established church or religious organization” or a sitting member of the House.

Seven nontheist individuals and four organizations sued in 2016, saying that plaintiffs who sought to deliver the invocation and were rejected because they did not practice a God-believing religion were denied their free speech and equal protection rights.

The Pennsylvania House’s rules regarding the prayer align with those of Congress, which the Supreme Court has relied on when making rulings on legislative prayer.

Last year, a Court of Appeals for the District of Columbia Circuit ruled that the U.S. House of Representatives chaplain did not have to allow an atheist to give a secular prayer in the House.

"First, only theistic prayer can satisfy all the traditional purposes of legislative prayer. Second, the Supreme Court has long taken as given that prayer presumes invoking a higher power," the appeals court ruled. "Legislative prayer has historically served many purposes, both secular and religious. Because only theistic prayer can achieve them all, the historical tradition supports the House’s choice to restrict prayer to theistic invocations."

The Americans United statement on Friday's ruling said, "While treating nontheists like second-class citizens may have been part of our nation’s history, it’s a shameful practice, hardly something we ought to uphold today."

The decision and others like it "preference believers in god while sending a message of exclusion and even scorn to nontheists," the organization said. "That type of unequal treatment is exactly what the separation of church and state is intended to prevent."

The lawsuit in Pennsylvania had also challenged House of Representatives directions, in signs and verbal directions, to "please rise" during the invocation.

But the appeals court ruling said that although a House security guard pressured two people to stand in 2012, that was a "one-off incident." The court said current policy does not force anyone to stand during the prayer, and the invitation to rise is "not coercive."