1. When, after a final judgment has been rendered, a convicted person is found to be suffering from a lasting state of serious mental disorder that prevents them from understanding the meaning of the sentence, the Judge of Penitentiary Supervision shall suspend the execution of the imposed custodial sentence, ensuring that they receive the necessary medical assistance. To this end, the Judge may order the imposition of a custodial security measure as provided for in this Code, which may not, under any circumstances, be more severe than the sentence being replaced. If the sentence is of a different nature, the Judge of Penitentiary Supervision shall assess whether the convicted person's condition allows them to understand the meaning of the sentence and, if so, shall suspend its execution, imposing the security measures deemed necessary.
The Judge of Penitentiary Supervision shall notify the Public Prosecutor's Office, sufficiently in advance, of the impending expiration of the sentence or security measure imposed, for the purposes of the provisions of the first additional provision of this Code.
2. Once the mental health of the convicted person has been restored, he or she shall serve the sentence if the penalty has not been prescribed, without prejudice to the fact that the Judge or Court, for reasons of equity, may extinguish the sentence or reduce its duration, to the extent that compliance with the penalty is unnecessary or counterproductive.