Two federal immigration officers who went to a Queens public school inquiring about a fourth-grader last week were turned away under New York City’s new policy barring enforcement agents from entering school property without a court order.

Mayor Bill de Blasio’s spokesman late Saturday on Twitter revealed news of Thursday’s incident, saying the mayor had “been briefed” about the situation involving federal immigration agents showing up at P.S. 58 in Maspeth, Queens, asking about a fourth-grade student.

The school turned the agents away, de Blasio’s spokesman Eric Phillips said on Twitter.

School administrators and security officers, under guidelines issued in March by de Blasio and Schools Chancellor Carmen Fariña, have been instructed to block federal immigration agents from entering school property without a warrant or court order.

The protocols were rolled out in response to ramped-up immigration enforcement efforts nationwide spurred by President Donald Trump. De Blasio vowed in March to “do all we can to ensure federal immigration actions do not harm or threaten our city’s residents.”

U.S. Citizenship and Immigration Services spokeswoman Anita Rios Moore said Sunday “two USCIS officials” visited the school “as part of an administrative inquiry pertaining to an immigration benefit request.”

Sign up to get the latest updates Get Newsday's Breaking News alerts in your inbox. By clicking Sign up, you agree to our privacy policy.

“Although school visits are not routine in these circumstances, they are not unprecedented,” Moore wrote in an email to Newsday on Sunday. “I must emphasize that the purpose of the visit was to verify certain facts about the student’s enrollment in relation to a request for an immigration benefit. At no time did the officers ask to see or speak with the student, who was not the subject of the administrative inquiry.”

Fariña, head of the public school system, said the department was “looking into this incident and . . . providing schools with additional information on our protocol and more trainings.”

“All students, regardless of immigration status, are welcome in New York City public schools, and parents should rest assured that we will do everything in our power to protect students, staff and families,” Fariña said.

Queens Borough President Melinda Katz, in a statement, said she was “deeply troubled and horrified” by reports of the incident, and commended P.S. 58 officials for “following proper protocols.”

“No parent should have to worry about any unauthorized persons or entities reaching their children while in school,” Katz said. “All schools must remain a safe space, where children’s safety is paramount. . . . Queens schools are to be off-limits to federal immigration agents.”