(KRON/BCN) — A Fairfield man arrested in Danville earlier this week for allegedly trying to have sex with a child was pronounced deceased at the hospital after attempting to hang himself while being transported to jail, the Contra Costa County Sheriff’s Office said Thursday.

Investigators went to a house in Danville to nab someone who solicited sex from a detective posing as a 13-year-old boy. A 50-year-old man from Fairfield was arrested in the residence on suspicion of arranging a meeting with a minor for lewd purposes, contacting a minor to commit a felony, attempted lewd acts on a child, attempted sending harmful material to seduce a minor, and resisting arrest.

While he was being transported to the Martinez Detention Facility, the suspect allegedly attempted to hang himself. Medical aid was given to him and the suspect was sent to a hospital where he was pronounced dead.

The Contra Costa District Attorney’s Office and sheriff’s office will conduct an investigation into the in-custody death, authorities said.