So Mr. Firman’s department began doing what many law enforcement officers around the country have learned to do: balance contradictory requests.

When the federal Immigration and Customs Enforcement agency wants to deport one of his inmates, the jail sends a fax notifying ICE before the inmate is about to walk free — leaving it to federal agents to show up and make an arrest.

But the fax is not necessarily sent with a great deal of advance notice.

In the case of Ever Valles, 19, a Mexican national awaiting trial for car theft, the Denver jail’s fax was sent in the middle of the night in late December, 10 hours after Mr. Valles posted bail but less than a half-hour before he walked free. ICE was nowhere to be seen.

Last Friday, Mr. Valles was charged with a much more serious crime: murdering a man at a light rail station in a robbery gone awry. Now, Mr. Firman is in the eye of a political storm that highlights the precarious position confronting many law enforcement officials.

Immigration officials accused Mr. Firman of ignoring their detainer request. “Had the officer for ICE been sitting at the fax machine, waiting for it to come in, it still would not have been enough time for us to come and get him,” said Shawn Neudauer, an ICE spokesman.