A North Carolina court has ruled against a Roman Catholic school that had fired a gay substitute teacher after he announced in 2014 on social media that he was going to marry his longtime partner.

US District Judge Max Cogburn ruled that Charlotte Catholic High School and the Roman Catholic Archdiocese of Charlotte violated Lonnie Billard’s federal protections against sex discrimination under Title VII of the Civil Rights Act, the Associated Press reported.

Cogburn granted summary judgment to Billard and said a trial must still be held to determine appropriate relief for him.

“After all this time, I have a sense of relief and a sense of vindication. I wish I could have remained teaching all this time,” Billard said in a statement released by the ACLU, which represented him in court.

“Today’s decision validates that I did nothing wrong by being a gay man,” the statement added.

Billard taught English and drama full-time at the school for more than a decade, earning its Teacher of the Year award in 2012. He then transitioned to a role as a regular substitute teacher, typically working more than a dozen weeks per year, according to his 2017 lawsuit.

He posted about his upcoming wedding in October 2014 and was informed by an assistant principal several weeks later that he no longer had a job with the school, according to the ruling.

The defendants said that they fired Billard not because he was gay, but rather because “he engaged in ‘advocacy’ that went against the Catholic Church‘s beliefs” when he publicly announced he was marrying another man.

But the judge ruled that the school’s action did not fit into exemptions to labor law that give religious institutions leeway to require certain employees to adhere to religious teachings, nor was the school’s action protected by constitutional rights to religious freedom.

“Plaintiff is a lay employee, who comes onto the campus of a religious school for the limited purpose of teaching secular classes, with no mandate to inculcate students with Catholic teachings,” the judge ruled, according to AP.

The diocese said that it disagreed with the ruling and was considering how to proceed.

“The First Amendment, federal law, and recent Supreme Court decisions all recognize the rights of religious organizations to make employment decisions based on religious observance and preference. They do not — and should not — compel religious schools to employ teachers who publicly contradict their teachings,” the diocese statement, released to the Charrolette Observer said.