(a) No person who lacks the capacity to understand a proceeding against him or her or to assist effectively in his or her own defense as a result of mental disease or defect shall be tried, convicted, or sentenced for the commission of an offense so long as the incapacity endures.
(b) A court shall not enter a judgment of acquittal on the ground of mental disease or defect against a defendant who lacks the capacity to understand a proceeding against him or her or to assist effectively in his or her own defense as a result of mental disease or defect.