The incident occurred at a Middlesex County facility that houses more than 400 civilly committed sex offenders.