Section 178G. The duty of a sex offender required to register pursuant to this chapter and to comply with the requirements hereof shall, unless sooner terminated by the board under section 178L, end 20 years after such sex offender has been convicted or adjudicated or has been released from all custody or supervision, whichever last occurs, unless such sex offender was convicted of two or more sex offenses defined as sex offenses pursuant to the Jacob Wetterling Crimes Against Children and Sexually Violent Offender Registration Act, 42 U.S.C. section 14071, committed on different occasions, has been convicted of a sexually violent offense; has been determined by the sentencing court to be a sexually violent predator, or if such sex offender is otherwise subject to lifetime registration requirements as determined by the board pursuant to section 178D, in which cases the duty to register shall never be terminated. A person required to register with the sex offender registry board may make an application to said board to terminate the obligation upon proof, by clear and convincing evidence, that the person has not committed a sex offense within ten years following conviction, adjudication or release from all custody or supervision, whichever is later, and is not likely to pose a danger to the safety of others. For so long as such sex offender is under a duty to register in the commonwealth or in any other state where the offender resides or would be under such a duty if residing in the commonwealth, such sex offender shall not be entitled to relief under the provisions of section 100A or 100B of chapter 276.