Margaret Gieszinger, a science teacher at University Preparatory High School in Visalia, California, was arrested on Wednesday.

She had been filmed singing "The Star-Spangled Banner" while cutting a student's hair at the front of a classroom.

She was arrested by police on suspicion of felony child endangerment.

A California high-school teacher was arrested on Wednesday after an Instagram video was posted that appeared to show her forcibly cutting a student's hair during class while belting out the national anthem.

Gieszinger was arrested on Wednesday. Tulare County Sheriff's Department Margaret Gieszinger, 52, is a science teacher at University Preparatory High School in Visalia.

In videos of the incident, Gieszinger is first seen standing in front of a student, cutting portions of the student's hair off and throwing them behind her.

As the student attempted to get up, Gieszinger said, "You're not done."

She then attempted to grab another student's hair, but the student was able to escape.

Other students then started screaming and running out of the classroom.

Throughout the clip, Gieszinger can be heard singing "The Star-Spangled Banner."

Students said they don't know what triggered the behavior, but said Gieszinger had been acting strange all week.

"I know that on Monday she had another freak out because a test was missing or something. She accused the students of taking the test," one student told ABC 30.

Read more: 10 of the biggest school controversies of the year

Gieszinger was arrested on suspicion of felony child endangerment, and her bail was set at $100,000.

Visalia Times Delta reported that, according to the Commission on Teacher Credentialing, Gieszinger's teaching credential was suspended in 2007 and 2016, for two weeks each time.

The reasons behind the suspensions remain unclear.