A man who came to a county jail to confess to his girlfriend's slaying, was allegedly turned away by a deputy and told to go to another jail to confess because the case was in the other jail's jurisdiction.

Hugo Ernesto Castro, 28, arrived to Santa Clara County Main Jail on Monday to "turn himself in," San Jose Mercury News reports. He then passed a note to a staffer that allegedly revealed the location of his former girlfriend's dead body, according to the Mercury News.

Castro was then allegedly directed by the staffer to a deputy who reportedly told Castro to walk to the San Jose police headquarters, which is the agency that held jurisdiction over the case, according to Mercury News. Castro walked out and later led San Jose police detectives to the body of his ex-girlfriend, Alessandra Barlas, 27, who was reportedly strangled and stabbed, Mercury News reports.

>> Read more trending stories

The San Jose Sheriff’s Office said to San Jose Mercury News that they are conducting an internal investigation on the deputy who failed to hold Castro in custody.

"Once they leave (a law enforcement building), who knows what's going to happen next," said Jim Dudley, a criminal-justice lecturer at San Francisco State University, to San Jose Mercury News. "Maybe they go the two blocks and turn themselves in. Or maybe they have second thoughts, or go home and destroy evidence."

Castro was arraigned in court Wednesday on one count of murder with a knife enhancement.

Read more at mercurynews.com