An illegal immigrant accused of rape was released from a Maryland jail three days after being arrested -- despite a request from Immigration and Customs Enforcement to keep the man in custody, according to federal officials.

Rodrigo Castro-Montejo, a Salvadoran national in the country illegally, was arrested Aug. 10 on charges of second-degree rape and second-degree assault. The 25-year-old allegedly assaulted a female friend after a night of heavy drinking, according to court documents obtained by FOX5.

During the investigation, police said they monitored the woman while she was at a local hospital. At one point she conversed with Castro-Montejo via text message and he allegedly admitted to the assault.

ICE PLACES HOLD ON TEXAS MAN ACCUSED OF LETTING DAUGHTER, 12, DRIVE IN CRASH THAT KILLED MAN, DOG

The woman reportedly asked Castro-Montejo in the messages if he stopped at touching her or went further and engaged in sexual intercourse. Castro Montejoto allegedly replied "Oo a little bit of both to be honest" and "I'm sorry," according to court documents obtained by WJLA.

On Aug. 12, ICE said it filed a detainer with the Montgomery County Detention Center to hold the 25-year-old for up to 48 hours so immigration officers could travel to the lockup and take him into custody. But federal officials said the jail declined to honor the detainer, and let Castro-Montejo walk out of jail Aug. 13 after he posted bond.

ICE ARRESTS ILLEGAL IMMIGRANT ACCUSED OF RAPE 2 MONTHS AFTER HE WAS RELEASED ON BOND

The Montgomery County Department of Correction and Rehabilitation told FOX5 in a statement the jail notified ICE at noon on Aug. 13 to inform them Castro-Montejo was being processed for release that day.

The jail said it contacted federal officials "using a number to a local ICE supervisor provided by that agency for notification purposes," but did not receive a follow-up call back from ICE. The jail said Castro-Montejo was released six hours later, and the jail has still not received a follow-up call -- "nor any other communication" -- since notifying ICE of his release.

ICE told WJLA, however, that officials at the jail called one employee who was "off duty" and "outside the area" on the day the 25-year-old was released. ICE told the television station the Maryland jail should have contacted multiple officers or followed instructions on a detainer form, which directs law enforcement agencies to contact the Law Enforcement Support Center. The LESC operates around the clock seven days a week.

CLICK HERE FOR THE FOX NEWS APP

Montgomery County, Md., designated itself for “sanctuary” status in July, according to FOX5.

The order signed by County Executive Mark Elrich says no county agency – including police departments – can cooperate with ICE. ICE agents are now barred from entering secure portions of county jails, and now have to take custody of illegal immigrants in public areas, such as jail parking lots.

Castro-Montejo is scheduled to appear in court again Sept. 6, according to WJLA.