An undocumented man whose case became a flash point in the ferocious national debate over sanctuary cities — he sexually assaulted a child after being released from local custody in Philadelphia — was sentenced Tuesday to an additional 21 months in prison for immigration offenses.

Juan Ramon Vasquez, 50, already serving eight to 20 years for sexually assaulting his girlfriend’s 5-year-old daughter, swore to U.S. District Judge Nitza Quiñones Alejandro that he would never come back to the United States once he’s freed.

She sentenced Vasquez for reentering the country after having been deported, for which he faced a maximum of two years. She ruled that the sentence be served consecutively, meaning Vasquez will be turned over to federal custody at the end of his state prison sentence.

After that he’ll be deported to Honduras, his homeland.

“Thank you,” Vasquez told the judge after sentencing at the federal courthouse in Center City, “because during the time I’ve been in jail, the authorities have treated me very well.”

For people who support sanctuary city policies as lawful, welcoming, and best for public safety — including Mayor Jim Kenney — the Vasquez case has been a nightmare. For those who demand stricter immigration laws and swift, hard enforcement, it’s proof of the danger that migrants can pose.

The sentencing came as the Kenney and Trump administrations continue to battle in federal court over the city’s right to receive federal law enforcement grants, even if it refuses to help U.S. authorities enforce immigration laws. In June, a federal judge in Philadelphia barred the Justice Department from seeking to compel the city to comply by withholding the grants, and this month the U.S. Court of Appeals for the Third Circuit largely upheld that ruling.

A key issue in the case revolves around the city’s refusal to honor U.S. Immigration and Customs Enforcement requests to hold undocumented immigrants who are being released from city jails. City officials say that they will respond to those requests, known as ICE detainers, only if the paperwork is accompanied by a signed arrest warrant from a judge.

“The facts of this case illustrate all too well the direct threat to public safety caused by the city of Philadelphia’s sanctuary city policies,” U.S. Attorney William McSwain said in a news release titled “Defendant Who Raped a Child Because of Philadelphia’s Sanctuary City Policies Is Sentenced to Prison for Illegal Reentry.” “After the city let this criminal loose ... Vasquez repeatedly raped his girlfriend’s daughter over an 18-month period. If the ICE detainer had been honored by local law enforcement, this crime never would have happened, and the victim — an innocent child — would have been spared horrendous physical and mental trauma.”

McSwain, who was nominated for his position by President Donald Trump, said criminals like Vasquez should know: "My office will do everything in its power to find you, to protect our community, and to seek justice for your victims. Unlike the Philadelphia government, we are not on your side.”

Kenney spokesperson Mike Dunn said that if federal immigration authorities had obtained an arrest warrant for Vasquez, he would have been released into their custody. But the federal government “failed to meet this very simple legal obligation.”

“The city of Philadelphia has always cooperated fully with federal arrest warrants, and we will continue to do so," he said. "We simply request that ICE obtain a warrant to ensure compliance with the United States Constitution. This request is not burdensome.”

A warrant signed by a judge would give the city a legal basis for continuing to hold someone. An ICE detainer, signed by an ICE employee, is insufficient, he said.

City officials maintain that they have no authority to hold anyone beyond the time they would normally be released from custody. Further, Kenney and Police Commissioner Richard Ross have argued that making local police help find and deport undocumented residents makes it less likely that people who lack legal status will come forward to report crimes — endangering the wider community.

Federal immigration authorities say that those additional requirements are overly burdensome and that ICE detainers are a legal way to keep dangerous criminals from going free. They have repeatedly held up Vasquez as the kind of danger that city policies can loose upon the public.

“You are a threat to society,” the judge told Vasquez on Tuesday. “Despite your exhibiting remorsefulness, it’s still a threat.”

Philadelphia police arrested Vasquez — who also used the name Ramon Aguirre-Ochoa — on charges of aggravated assault in 2014. The case against him was dropped the following year, and he was released, under a similar Nutter administration policy, despite an ICE detainer requesting that he be held for possible deportation.

About a year and a half later, Vasquez was arrested again, this time for raping the child. He pleaded guilty and in 2017 was sentenced to eight to 20 years in prison.

Federal prosecutors filed their criminal immigration case against him in 2016, and he pleaded guilty last year to one count of illegally reentering the country after deportation.

In court on Tuesday, Vasquez, with the aid of defense counsel Mythri Jayaraman, described a pitiful life in Honduras, growing up as one of 11 impoverished brothers and sisters. Vasquez had to leave school after third grade to help work on the family farm.

When he was older, he left for the United States, working in a Korean restaurant and at a metal-recycling plant, to send money home to his own five children. In prison, he said, he’s taken classes in English and Spanish — he’s illiterate — and in religious study.

“I know that I committed a very serious crime," Vasquez told the court. “I know entering this country illegally is a crime. But since I’ve been in jail, I’ve learned a lot of things. ... The way I live has changed, the way I think has changed, the way I act, all of it.”