A gay teacher in New Jersey has said he was recently fired from a Catholic school he worked at for 12 years after applying to marry his partner – a move the school said “contradicts the terms of his teaching contract.”

High school teacher Michael Griffin, who taught Spanish and French at the Holy Ghost Preparatory School in Pennsylvania, said his relationship with his partner of 12 years was no secret to his colleagues.

However, headmaster Father James McCloskey decided to terminate his contract on Friday after Mr Griffin had arranged to arrive late to classes so he could obtain a same-sex marriage license in New Jersey.

According to 6ABC, Mr Griffin said: “I really didn’t think that it would happen. At our school we talk about it’s a community. Our motto is ‘One heart, one mind’.”

He reportedly left in tears after he was called into the office Mr McCloskey along with Principal Jeffrey Danilak, who told him they had “no choice” but to fire him.

Mr Griffin first posted about his termination on Facebook Friday morning.

He wrote: “Today I applied for a marriage license since NJ (New Jersey) now has marriage equality. After 12 years together I was excited to finally be able to marry my partner. Because of that, I was fired from Holy Ghost Preparatory School today.

“I am an alumnus of the school and have taught there for 12 years. I feel hurt, saddened, betrayed and except for this post, am at a loss for words.”

Mr Griffin added he was shocked by the school’s reaction, as he had previously made no attempts to conceal his relationship in the past.

He said: “I’ve been with my partner for more than 12 years, the entire time I’ve been teaching at the school. He’s been to numerous school functions with me, he’s even been to McCloskey’s house.”

Father McCloskey said in a statement obtained by NBC10 that Mr Griffin’s same-sex marriage was a violation of the school’s teaching terms and contract.

He said: “At a meeting in my office yesterday, teacher Michael Griffin made clear that he obtained a license to marry his same sex partner.

“Unfortunately, this decision contradicts the terms of his teaching contract at our school, which requires all faculty and staff to follow the teachings of the Church as a condition of their employment.

“In discussion with Mr Griffin, he acknowledged that he was aware of this provision, yet he said that he intended to go ahead with the ceremony. Regretfully, we informed Mr Griffin that we have no choice but to terminate his contract effective immediately.”

On Saturday, following a torrent of support from across social media websites, Mr Griffin posted another statement on his Facebook page.

He wrote: “Thank you to everyone for all of your messages of love and support since yesterday It is so overwhelming and my heart aches over everything that has happened. Holy Ghost helped form me to be the person that I am today.

“Even though I am no longer employed there, I wanted to share their mission and philosophy, because I feel like I have tried to make it my life’s philosophy as best I can, even now. I am trying to move forward with a peaceful heart and wish nothing but the best to my colleagues and students who mean the world to me.”

“I really did love working there, I went to school there, they formed who I am. I’m sure I’ll find employment at another school, hopefully rather sooner than later.”

New Jersey became the 14th US State to legalise same-sex marriage in October. Pennsylvania state has yet to legalise equal marriage.

In November, a pastor who was put on “trial” by his congregation after officiating at his own son’s same-sex wedding was found guilty for violating church law.