Mayor Vincent C. Gray (D) signed an executive order Wednesday that prohibits public safety agencies from asking about a person’s immigrant status or contacting U.S. Immigration and Customs Enforcement.

The order applies to the corrections, police and fire departments, the attorney general’s office and other agencies.

It does not apply if a person’s immigrant status pertains to a criminal investigation.

Gray was cheered on by a group of mostly Latino city residents who watched him sign the order at his weekly news briefing. Representatives of other immigrant communities also joined the mayor at the event.