Sex offender to remain in state custody