MIAMI – A 7-year-old boy was led away from his Miami school in handcuffs this week after he attacked a teacher, police and school officials said.

The video that shows the handcuffed boy and a police officer walking through the school grounds and eventually to a patrol car has gone viral on social media.

Miami-Dade Schools police said that Thursday the teacher told the boy, a student at Coral Way Bilingual K-8 Center, to stop playing with his food. Sometime later, the teacher was talking about the incident with another school employee when the boy attacked, punching the teacher on the back.

Police said the teacher tried to restrain the boy, but he continued to kick and punch, causing the pair to fall to the ground. While on the floor, the boy grabbed the teacher's hair, police said.

Finally restrained by the teacher, the boy calmed down and went to the principal's office, police said. School officials said several students and the other school employee witnessed the attack. School security cameras also recorded the incident, officials said.

The cellphone video was recorded by the boy's mother.

Mercy Alvarez told Local 10 News that it's the hardest thing she's ever had to live through.

The boy's father said this went too far.

"I know that my kid made a mistake," he said. "This is completely insane."

Because of the boy's recent behavior, school officials initiated Baker Act proceedings. The state law allows for judges, law enforcement officials, physicians, or mental health professionals to involuntary examine a person if they believe that person is likely to cause serious bodily harm in the future.

Miami-Dade school police said the boy's father agreed that he needed mental health treatment, but his mother disagreed. She told police there was nothing wrong with him.

The student was taken to Nicklaus Children's Hospital in Miami for evaluation.

"It is rare for students this young to be Baker Acted. However, this action was warranted to prevent his erratic and violent behavior from bringing further harm to others or himself," said Ian Moffett, the chief of the Miami-Dade Schools Police Department.

Moffett also defended the department's decision to handcuff the student and put him in a patrol car.

"The manner in which he was transported to the receiving facility was done in accordance with Standard Operating Procedures," Moffett said. "Our Professional Compliance Unit is thoroughly reviewing this incident."

Local 10 News has learned the child's parents are considering taking legal action against the school district.