A Texas teacher who was fired after asking President Donald Trump to remove undocumented students from her school, in a series of public tweets that she thought were private messages to Trump, has won an appeal to keep her job.

Texas Education Agency Commissioner Mike Morath ruled Monday that Georgia Clark should be reinstated with back pay and employment benefits or a year's salary from the Fort Worth Independent School District.

A state-appointed independent examiner previously issued a recommendation that found there was not good cause to terminate Clark, the ruling states.

The tweets by Clark, who taught English at Amon Carter-Riverside High School, were protected by free speech and did not violate district policies, the independent examiner wrote.

The board of the Fort Worth Independent School District voted unanimously to terminate Clark's contract in June, less than a week after she was suspended over the tweets.

District spokeswoman Barbara Griffith said Tuesday it will appeal the ruling to reinstate Clark and that the commissioner's decision "was not based on the merits of the case but rather a procedural technicality with which the district does not agree."

Superintendent Kent P. Scribner said in a statement that the district stood by its decision to fire Clark because “we firmly believe this is in the best interests of all students.”

Clark's attorney, Brandon Brim, did not immediately return a request for comment.

On May 17, Clark said in a series of tweets addressed to Trump that the school she worked at had been “taken over” by “illegal students from Mexico” and that anything the president could do to remove "illegals from Fort Worth would be greatly appreciated."

Her account was deleted in late May and she was placed on administrative leave after the school district became aware of her tweets. Clark told investigators she was unaware the tweets were public and thought she was sending direct messages to the president.

Almost 35 percent of the Fort Worth population identified as Hispanic or Latino in 2018. The Hispanic student population in Fort Worth Independent School District is nearly 63 percent. About 87 percent of the students Clark had been teaching are Hispanic, according to 2018-2019 data.

Clark has been investigated in the past. She was suspended in 2013 after she allegedly referred to a group of students as "Little Mexico" and one student as "white bread," according to district records obtained by NBC Dallas-Fort Worth.