A veteran Pinellas Technical Education Centers teacher is recovering after Pinellas County Schools police said he was beaten by a student in class Monday morning.

Court documents reveal Wesley Lee Cox, 32, a student, took out a baseball bat at the school's Clearwater Campus at around 7:30 a.m. in a computer class and just began swinging.

Police said he not only hit the teacher, but another student, as well, before a third student jumped in and broke it up.  A school resource officer and several administrators responded to the classroom within a minute and subdued Cox.

The teacher, James Humphrey, has taught at the school for more than a decade.

The teacher was taken to Bayfront Medical Center. Both he and the other student hit sustained non-life threatening injuries.

Police said nothing out of the ordinary happened before the attack and they believe Cox had not had any problems at the school before this.

"We're not really sure what the motive was," said Chief Rick Stelljes, of the Pinellas County Schools police. "My understanding is that he was making some irrational statements of some sort that nobody could really make sense of and started swinging the bat."

Police said Cox should not have had the bat on campus and they are now trying to figure out how he got the bat into the classroom.

In the arrest warrant affidavit, Cox admitted to the crime and told investigators he went to the school to cause great bodily harm and that he went to beat people with a bat.

Cox is being charged with two counts of aggravated battery. The school has also issued a no trespass warning against him.

The teacher's family declined comment Monday night while no one came to the door at the Tampa address listed for Cox.

Cox is being held on $20,000 bond. He could face a judge as early as Tuesday morning.