The hunt is underway for a convicted felon who was to be deported to Mexico but was accidentally released from the East Baton Rouge Parish Prison a week ago after he was arrested on allegations that he dealt cocaine.

The mistaken release of Bernardo Gomez, 27, occurred Aug. 29 after an employee of the East Baton Rouge Parish Sheriff’s Office failed to note in the prison’s information system that jailers had been told to hold Gomez, even if he posted bail.

The U.S. Immigration and Customs Enforcement had placed a detainer on Gomez because a federal immigration judge in August ordered him to be deported to Mexico, an ICE spokesman said.

The detainer meant that even if Gomez posted bail, ICE would be notified so agents could take him back into custody until he was deported, Bryan D. Cox, the ICE spokesman, said.

However, when Gomez posted a $39,000 bail on a count of distributing or manufacturing Schedule II drugs, he was released from Parish Prison, a Sheriff’s Office spokeswoman said.

Prior to being brought to Parish Prison, Gomez had been in custody at another jail in Louisiana.

He pleaded guilty in June to three federal counts of distributing cocaine — a conviction for which he received a suspended sentence of two years on top of the jail time he already served awaiting the adjudication of his indictment. It’s unclear in what jail he was being held at the time.

After that conviction, ICE agents took custody of Gomez and detained him at one of its two Louisiana facilities while he awaited the outcome of his immigration status. But before he could be deported, Gomez had to face any criminal matters still pending in the United States, Cox said.

One outstanding matter was a warrant obtained by the State Police. Troopers took custody of Gomez from ICE on Aug. 21 and booked him into Parish Prison. Gomez stayed there about a week before he posted bail and was mistakenly released.

The Sheriff’s Office employee who made the clerical error was suspended and counseled, said Casey Rayborn Hicks, the Sheriff’s Office spokeswoman.

The Sheriff’s Office issued a warrant for Gomez’s arrest Thursday based on the erroneous release.

Anyone with information about Gomez’s location is asked to contact the Sheriff’s Office at (225) 389-5000 or Crime Stoppers at (225) 344-7867.

Follow Ben Wallace on Twitter, @_BenWallace.