A cellphone camera captured the arrest of a teen at a Toronto high school for what police are calling the first attack on an officer working under a high school policing program.

The incident occurred at Northern Secondary School on Friday. The officer involved was at the school under the auspices of the school resource officer program, in which officers are assigned full time to 50 high schools around the city.

Toronto police have touted the program, which began last September, as a way to engender closer ties with students and the community.

At the start of the video, which is posted on YouTube, a boy appears to be scuffling with the officer as a crowd of students gather to watch. The officer is shown repeatedly asking the boy to put his hands behind his back.

Throughout the 3½-minute clip, the boy constantly protests he did nothing wrong.

The officer eventually seizes the boy and marches him to a school office.

Police said the fracas began after the officer asked the boy to identify himself, suspecting he may not have been a student at the school.

But the boy — who was a student at the school — insulted him instead, and that's when the officer acted, police said.

The student was charged with assault and intent to resist arrest. The officer suffered minor injuries and has returned to duty at the school.

Police have called the arrest an isolated incident and said the officer handled himself well, considering the circumstances.