A teacher at a Catholic school in the US state of California was sacked days after marrying his partner in a civil ceremony.

Ken Bencomo served at St Lucy’s Priory High School in Glendora, California, for 17 years, and was one of the first to marry after the Supreme Court made a ruling on the state’s ban on equal marriage last month which effectively reversed it.

He married his husband Christopher Persky, 32, on 1 July, and was photographed for the press, and appeared in a video following his marriage.

“The reason given was that the marriage occurred and the school’s position was that it violated church teachings,” said attorney Patrick McGarrigle.

Students apparently knew Mr Bencomo was gay, despite the fact that he never openly discussed his sexuality with students.

“He never talked about his personal life to his students, but it’s something that students and faculty knew,” said former student Abigail O’Brien, 19. McGarrigle said the school was aware that he is gay before he got married.

“St. Lucy’s has known of Mr. Bencomo’s orientation for years,” McGarrigle said. “Administrators had been introduced to his partner in the past, so the suggestion that Ken’s orientation is a surprise or that his lifestyle somehow violated doctrine is at odds with the school’s knowledge and what seemed to be acceptance of him until most recently.”

Bencomo, 45, was the head of the English department, as well as a yearbook moderator and dance coach. An online petition protesting his dismissal gathered 2,000 signatures by Wednesday.

The school has not issued a statement on the issue, but did say that it would continue to educate students “in the tradition of the Catholic faith… As a Benedictine school, St. Lucy’s is a community for those who wish to express Christian values in education and develop person and academic excellence”.

Some have argued that the decision by the school was right, and that Mr Bencomo should have declined to appear in the newspaper article.

The Diocese of San Bernardino said its discrimination policy bans action against teachers based on lifestyle choice, but that entering a same-sex marriage goes contrary to church teachings.

McGarrigle said that Mr Bencomo wanted to resolve the issue without legal action, if possible