Montgomery County’s top elected official, Marc Elrich, stood before a bank of TV cameras this summer to praise the county’s diversity and promise the most limited of cooperation with federal immigration agents.

“I’d say we’ve learned how to manage immigration pretty well,” he said, “without a lot of drama and nonsense.”

Since then, there’s been plenty of both — at least according to the opposing sides of a roiling political debate centered on the left-leaning Maryland jurisdiction.

National attention has fallen on Montgomery in large part because over the five-week stretch since the county executive’s pronouncement, seven undocumented immigrants living in the county were arrested on sex assault charges . Two were accused of raping the same 11-year-old girl. Another reportedly tried to kill his victim by choking her in a hallway of her apartment building.

By Friday afternoon, Ken Cuccinelli, the acting director of U.S. Citizenship and Immigration Services, tweeted a debate challenge to Elrich (D) over the merits of what Cuccinelli described as the county’s sanctuary protection policies for undocumented immigrants.

“I’ll defend children and crime victims,” Cuccinelli wrote, “Elrich can defend rapists and murders who shouldn’t even be in this country.”

“It’s a stunt,” Elrich shot back in an interview Friday. “I might debate him if he’d agree with the statement that Montgomery County is not a ‘sanctuary city’ and that Montgomery County is not protecting criminals. . . . The guys in jail would probably not feel very protected.”

At the heart of the sharp political clash is a policy debate about how local jails respond to federal “detainer” requests, which Immigration and Customs Enforcement (ICE) agents use to try to have jails alert them when a criminal suspect whom federal officials suspect is in the country illegally is about to be released from custody.

Some jurisdictions — including Frederick County, Md., just north of Montgomery County — have robust cooperating agreements. Local officials not only alert federal agents of pending releases, they give the federal agents up to 48 hours to get there to pick up a suspect with a detainer. Their reasoning is that given logistics such as staffing levels, traffic tie-ups and trying to coordinate detainee transfers, holding suspects for ICE makes sense.

Other areas don’t honor detainer requests, thinking that avoiding the process completely assures their residents that local officials aren’t communicating at any level with ICE and assisting in deportation efforts.

Elrich, who took office last year, moved Montgomery closer to the second group.

Under him, jail officials notify ICE of a pending release of someone with a detainer who has been charged with serious crimes such as murders, sex assaults and violent assaults.

“I’m not so sympathetic that I’m going to turn my back on people committing crimes — no way,” Elrich said.

Elrich also recently directed county jail officials not to allow ICE agents into the secure, locked portions of jails, a shift made as part of a broader executive order restricting the agents from any “nonpublic space within a government facility.”

As a result, ICE agents who make it to the Montgomery County jail within what ICE says is a roughly hour window must wait in areas with the general public to take custody of someone, or be left to go later to the suspect’s listed address or another location they are known to stay.

That approach seems correct, said Gustavo Torres, executive director of Casa de Maryland, an immigrant rights group, who said Elrich’s policy gives ICE a chance to pick up the most violent suspects, but not detain anyone longer than necessary and not engage in any kind of immigration enforcement.

“It’s a tragedy when crimes committed by anyone get politicized,” he said. “We need to let the judiciary process play out for the suspects and focus on the victims of these terrible crimes and their families.”

But the Montgomery approach makes it more difficult for ICE agents to do their jobs, Frank Madrigal, an ICE deputy field office director in Baltimore, said in written responses to questions last week. That, along with the ban against allowing them into the secured areas of the jail, makes it “more dangerous for the officers, heightens risk for the targeted individuals and even the public, and is resource intensive for ICE,” Madrigal wrote.

In Frederick County, just north of Montgomery, jail officials ask basic citizenship questions of every new inmate, the answers of which can trigger an immigration check that is relayed to ICE. As for honoring detainer requests, Frederick officials will hold soon-to-be released inmates until federal agents arrive — a process that can take four hours or more, according to Frederick County Sheriff Chuck Jenkins.

Expecting them to arrive within an hour is “really ridiculous,” Jenkins said. “It’s an unrealistic expectation. ICE agents are spread thin.”

Critics within Montgomery say tepid compliance with detainer requests is a draw for people apt to commit local crimes.

“That makes the county less safe,” said Alexander Bush, chairman of the Montgomery County Republican Party.

He and others cite the recent case of Rodrigo Castro-Montejo, 25, arrested Aug. 11 on charges of second-degree rape for allegedly forcing himself on a friend who was too intoxicated to consent to sex, according to a police account in court documents.

On Aug. 12, ICE filed a detainer request with Montgomery jail officials, asking to be notified if Castro-Montejo was set to be released. A short time later, when the jail learned Castro-Montejo was preparing to post bond in his local case and leave jail, a jail official called an ICE agent about the impending release.

According to ICE and Montgomery officials, the federal agent was off duty and on travel status, and no one at the jail called a 24-hour backup number listed on detainer requests. Castro-Montejo was released from custody. He has an upcoming court date of Sept. 27 in the Montgomery case.

Castro-Montejo’s attorney, Barry Helfand, said his client wants to fight the allegations.

“He’s not going anywhere,” Helfand said. “We believe he’s innocent, and we think a jury will believe that, too.”

Elrich acknowledged the county’s error and said he is ensuring the backup number is called when an agent cannot be reached directly. He said Friday he is open to possibly allowing ICE back into the Montgomery Detention Center to take custody of suspects facing release who have detainers in place.

“We’re having a conversation about whether we’re putting anybody in jeopardy” by requiring ICE agents to wait or act in public places rather than the controlled confines of a secured area in the jail, he said.

The limited cooperation, Elrich said, should still be reassuring to undocumented residents that the county is not closely linked to immigration enforcement agents.

Like Castro-Montejo’s case, the six others that vaulted to national attention all include detainer requests from ICE. The agency has said all seven are “unlawfully present” in the country.

Five of those suspects are in the county jail pending trials — four of them held without bond on serious charges that preclude release, which Elrich noted moots the urgency in the detainer debate.

The remaining suspect, Nestor Lopez-Guzman, was in the Montgomery Detention Center on Aug. 19 when he gave notice he was about to post a $15,000 bond. He is charged with two counts of child sex abuse for alleged fondling and improper touching of two victims, according to police accusations in court filings. Online court records do not list an attorney for him.

ICE officials said they were able to take “custody of Lopez-Guzman pursuant to the detainer.”

The next day, Lopez-Guzman posted an immigration bond and was released, pending further court or removal actions.

“Their actions demonstrate that they are, oddly enough, bound by the same laws we are,” Elrich said. “The fact that ICE picked you up doesn’t mean you’re going to stay off the streets either.”