‘ 4-F. If the State pleads and proves that a crime under section 253 was committed against a person who had not yet attained 12 years of age and that the defendant had previously been convicted and sentenced for committing gross sexual assault, formerly denominated as gross sexual misconduct, or rape, or had previously been convicted and sentenced for engaging in substantially similar conduct in another jurisdiction against a person who had not yet attained 12 years of age, the court, notwithstanding subsection 2, shall impose a term of imprisonment for life.’