A federal appeals court has lifted a ban on public prayer during a graduation at a San Antonio high school.

The ruling reverses a decision of a lower court that imposed the ban after an agnostic family, Christa and Danny Schultz, sued the school district.

The Schultzes claiming traditions at graduation, including the invocation and benediction, excluded their beliefs and violated their constitutional rights. Watching their son receive his diploma would amount to forced religious participation.

A federal judge agreed and banned public prayer at the graduation on Tuesday.

But Medina Valley High School valedictorian Angela Hildenbrand refused to give up, insisting her free speech rights would be violated if she wasn't allowed to thank God in her graduation speech.

Hildenbrand went to court Thursday with Texas Attorney General Greg Abbott in her corner. She filed an intervention lawsuit that claimed she was being deprived of her right to pray for her classmates and community during her speech.

On Friday, the appeals court lifted the ban.

Upon hearing of the court's decision, Hildenbrand paused for a few seconds and then said she "took the time to thank God."

"We're just so, so thrilled with the court's ruling," said Hildenbrand, who was helped by the conservative Liberty Institute, which supported the school district's appeal. "We could just not be more pleased with how it turned out."

"It should not be illegal for students to say a prayer at a graduation ceremony. Now, the federal court of appeals agrees," Abbott said.

Earlier in the day, an appalled Gov. Rick Perry got into the fray, issuing the following statement admonishing the federal judge who imposed the ban:

"This reprehensible action taken by a federal judge underscores the increasingly inappropriate federal encroachment into the lives of Americans by unconstitutionally banning prayer at a Texas high school graduation. The First Amendment prohibits governments from interfering with Americans' rights to freely express their religious beliefs, and accordingly the U.S. Supreme Court has maintained that Congress may convene every day with a prayer. I fully support Attorney General Abbott's efforts to defend the right to pray, and Texas will continue to stand behind all those who wish to pray in our state."

Friday's ruling allows students at the high school to say the words "amen" and invite the audience to pray during Saturday's graduation ceremony.

U.S. District Judge Fred Biery's original ruling prohibited students from praying at the graduation. Biery instead said students could modify their remarks to be "statements of their own beliefs," allow them to make the sign of the cross, wear a yarmulke or hijab, or kneel to face Mecca.

Biery said the family was likely to succeed on the merits of their claim that public prayer would violate the establishment clause of the First Amendment. The appeals court disagreed and said the lawsuit may be partly rooted in circumstances that are no longer in the ceremony.

"For example, the school has apparently abandoned including the words 'invocation' and 'benediction,"' the panel wrote in a brief two-page ruling.

The school district did not immediately comment on the appeal.

Associated Press writers Paul J. Weber and Linda Stewart Ball contributed to this report.