Any person who is convicted of murder shall be imprisoned for life. However, if it appears to the court that a person convicted of murder was under 18 years of age at the time of the offence, the court has a discretion as to whether the person should be sentenced to imprisonment for life or to imprisonment for a shorter term.