 Sections 224 and 227 of the Criminal Justice Act 2003 require the court to pass an extended sentence of imprisonment (if the offender was aged 21 or over on conviction) or an extended sentence of detention in a young offender institution (if he was aged 18, 19 or 20 on conviction) in the following circumstances