A high school teacher in Texas was fired after he told his students he was gay in a text message.

Dr. Josh Hamilton was the coach of Grapevine High School's competitive speech team.

He came out to his speech team in a text message intended to motivate them to focus on an approaching tournament.

“Guys, I get it. We all have something going on,” he wrote, adding that he overcame depression and came out as “a happy functioning gay man.”

The following day, Hamilton was questioned by the district's human resources department. He handed over his phone so that administrators could see the messages he sent students.

He was placed on administrative leave. The Grapevine-Colleyville board recently voted unanimously to fire Hamilton for violating the district's texting policy. The Board of Trustees also voted unanimously to remove Hamilton.

"Dr. Hamilton violated the standards by developing inappropriate relationships with students, providing inappropriate information to the students concerning his personal life, through text messages, treating students as family members or close friends and providing inappropriate personal information to the students," the district said.

One text was sent to a student who watches his child. The district questioned a text in which Hamilton told the student that he was going on a date. Hamilton said that the student needed to know where he was going to be in case of an emergency.

“Sitting in the boardroom and hearing her use the word inappropriate, inappropriate, inappropriate painted me to the public as a child predator,” Hamilton told NBC 5.

He said he would appeal the ruling.