A 17-year-old illegal immigrant -- behind bars on a murder charge -- was released from a local North Carolina jail that just pulled out of an immigration screening program with Immigration Customs and Enforcement.

Sergio Coello-Perez, a Mexican national, was released from the Mecklenburg County Jail Thursday after seven months in custody with a written promise to appear in court and to wear a 24-hour electronic monitoring bracelet, WBTV reported Friday.

On Friday, the teen was booked into the jail again after prosecutors obtained a court order for his arrest “to correct a clerical error” dealing with his bond status, according to the station.

CLICK HERE TO GET THE FOX NEWS APP

Coello-Perez was sprung for 31 hours, the station reported.

He was 16 in May when prosecutors said he and a friend tried to steal a car in Charlotte and shot and killed the owner, Nicholas Boger, who tried to stop them. A judge jailed Coello-Perez without bail after his arrest.

WBTV reported that Immigration and Customs Enforcement had a hold on Coello-Perez at the jail.

The station quoted a spokesperson for the Mecklenburg County Sheriff’s Office as saying that the “ICE hold was lifted” but that was not why Coello-Perez was released.

Three weeks ago Garry McFadden was sworn in as Mecklenburg County sheriff and announced that he was ending the screening program that allowed deputies to perform immigration enforcement duties inside the jail with supervision from ICE.

CALIFORNIA ILLEGAL IMMIGRANT ‘COP-KILLER’ TAKEN INTO CUSTODY, OFFICIALS SAY

McFadden said ICE officials would need court-issued warrants or detainers to access the jail while he is sheriff.

The program had sent thousands of people into deportation proceedings since 2006. Ending it was a major part of McFadden's election campaign.

The Associated Press contributed to this report.