Mayor Bill de Blasio officially sent the NYPD a memo to keep federal agents off school grounds unless they're complying with visitation rules. 

Last week, City Hall announced guidelines for principals and school safety officers on how to respond if federal immigration officers come asking for students or families.

Those guidelines say the NYPD has to be on location to admit non-local officers, and agents have to present a warrant signed by a federal judge.

Federal immigration agents also have their own policies for enforcement in "sensitive locations" including schools.

A City Hall spokesperson says the Mayor is committed to fighting harmful immigration actions and to keeping schools safe.