"I married a man in 2012. This wouldn't be of any importance if it wasn't for the fact that I work as a religion teacher in two public secondary schools in Lanzarote ," Luis Alberto González Delgado wrote in a letter to Spanish daily El País.
"At the end of the year I got married, I thought it was opportune, for reasons of transparency, that I reveal my status to the bishop," he added in the letter titled 'Good news'.
Same-sex unions have been legal in gay-friendly Spain since 2005, and over 20,000 such unions have taken place in the country since that time. But the Catholic Church remains staunchly opposed to gay marriages.
González expected the worst, assuming he would be sacked. But his contract was renewed year after year.
"Either the bishop of the Canaries doesn't believe the subject is important, or he has a new approach to the subject in his jurisdiction. In both cases, this is good news," González said in the letter published by El País on July 28th.
However, just two weeks after later, the teacher, who has fifteen years experience, has received a brief message saying that his services will no longer be required.
He told El País he was not surprised by the decision, and recognized his status as a married gay man could put him in conflict with the church. But the priest also questioned the "manipulation of beliefs by those who have religious power" and criticized meddling in what should be "private matters".
González, who now faces an uncertain future as a teacher, has said, however, that he doesn't want to leave the church and believes the fight is best fought from within its ranks.
The former priest's dismissal has been condemned by Spain's State Federation of Lesbians, Gays, Transsexuals and Bisexuals (FELTGB).
In a statement, the group called the decision to fire a teacher from a public school "unjustifiable".
"This pact between the Catholic Church and the State is shameful," said FELTGB Secretary General Jesús Generelo. Schools were "spaces for learning, not indoctrination", he added.