A South Carolina high school principal said he'll resign from his post after the district approved an organization for gay students that conflicts with his religious beliefs.

Eddie Walker, the principal of Irmo High School in Columbia, S.C., announced his intention to step down to faculty and students on Wednesday, saying he'll end his tenure following the 2008-09 school year. The decision, outlined in a letter to Lexington-Richland School District 5 officials, said the reason was the formation of a Gay-Straight Alliance Club for students.

"Allowing the formation of this club on our campus conflicts with my professional beliefs and religious convictions," Walker wrote in the letter, obtained by FOX affiliate WACH-TV.

• RAW DATA: Principal's Resignation Letter

Lexington-Richland School District 5 couldn't stop the club from forming because federal law prohibits discriminating against a club based on its purpose, spokeswoman Michelle Foster said.

"Attorneys have advised the school district that prohibiting the formation of this club would most certainly result in a costly lawsuit," the district said in a statement posted to its Web site. "Similar lawsuits in other parts of the country have been defended unsuccessfully."

The only other recourse would be to ban all non-curricular clubs, officials said.

Walker said the club — which he said would be the first based on sexual orientation, preference or activity at the school — conflicts with the school's abstinence-only education and may prompt students to have sex.

"I feel the formation of a Gay/Straight Alliance Club at Irmo High school implies that students joining the club will have chosen to or will choose to engage in sexual activity with members of the same sex, opposite sex, or members of both sexes," he wrote.

Walker did not return a call for comment by FOXNews.com Thursday. He declined to comment further on his decision to the Associated Press or local media.

In his letter, Walker wrote he prayed about the issue before stepping down and asked board members to "respect my choice as I respect your choice to disagree with me on this issue."

Walker, who has led the school since 2005, wrote he wanted to resign at the end of this school year, but he felt like he would break the trust of students and teachers who were already planning on him to come back.

South Carolina Equality Director Ray Drew told WACH-TV that the club provides support for gay, lesbian and straight students from an often hostile school environment. Reports show that in 2007, 31 percent of gay students were threatened or injured and 18 percent were physically assaulted because of their sexual orientation.

Gay-rights group Faith in America said Walker's decision is based on prejudice that is harmful to students and likened his decision to policies that once allowed segregation to flourish.

"We truly believe it is unfortunate that this principal cannot see the immense harm that is caused when a social climate of rejection, condemnation and violence is justified with misguided religious belief," said Brent Childers, executive director of the group.

One Irmo High School student, saddened by Walker's decision, said the principal was leaving for the wrong reasons.

"The reason he's leaving is not a good reason," Brion Hayes told WACH-TV. "He does a good job; he cares about the students that go to his school."

Click here for video on the story at WACH.com.

The Associated Press contributed to this report.