A veteran guidance counselor was arrested on Wednesday for attempting to prevent the police from detaining an emotionally disturbed student, police sources told the Eagle.

Police said a 19-year-old student at Grover Cleveland High School in Ridgewood was acting irrationally in the hallways, which prompted someone in the school to call 911. When police arrived the student was still acting out and the officers on the scene alerted the Emergency Service Unit (ESU) to come to the Ridgewood school.

Grover Cleveland High School in Ridgewood was the scene of a mediation gone wrong Wednesday. // DOE Photo

Phillip Lo Castro, a guidance counselor at the school since 2010, stepped in to talk to the student about his behavior.

When an officer on the scene then tried to separate Lo Castro from the student, Lo Castro slapped the officer’s hand, according to the criminal complaint.

Police said Lo Castro, 37, tried to prevent the student from getting detained.

As the officer tried to arrest Lo Castro, he flailed his arms, kicked his legs and punched the officer in the face to prevent getting arrested, according to the criminal complaint.

Doug Cohen, a spokesman with the Department of Education (DOE) said Lo Castro was assisting the student while ESU was called to the Himrod Street location.

Lo Castro was charged with assault, resisting arrest, obstructing governmental administration and disorderly conduct. Queens Criminal Court Judge Bruna Dibiase released Lo Castro on his own recognizance on Thursday morning and ordered him back to court on Dec. 5.

“We’ve reassigned him away from the school pending an NYPD investigation. We will continue to cooperate with NYPD as they investigate,” said Cohen.

Lo Castro, who has worked with the DOE since 2008, is expected to earn over $96,000 this year, according to public records.