Was Dylann Roof Guilty and Responsible? In this, it's the law that matters, and nothing but the law. Behold, the law of South Carolina:
SECTION 17-24-10. Affirmative defense.
(A) It is an affirmative defense to a prosecution for a crime that, at the time of the commission of the act constituting the offense, the defendant, as a result of mental disease or defect, lacked the capacity to distinguish moral or legal right from moral or legal wrong or to recognize the particular act charged as morally or legally wrong.
(B) The defendant has the burden of proving the defense of insanity by a preponderance of the evidence.
(C) Evidence of a mental disease or defect that is manifested only by repeated criminal or other antisocial conduct is not sufficient to establish the defense of insanity.
HISTORY: 1984 Act No. 396, Section 1; 1988 Act No. 323, Section 1; 1989 Act No. 93, Section 1.
SECTION 17-24-20. Guilty but mentally ill; general requirements for verdict.
(A) A defendant is guilty but mentally ill if, at the time of the commission of the act constituting the offense, he had the capacity to distinguish right from wrong or to recognize his act as being wrong as defined in Section 17-24-10(A), but because of mental disease or defect he lacked sufficient capacity to conform his conduct to the requirements of the law.
(B) To return a verdict of "guilty but mentally ill" the burden of proof is upon the State to prove beyond a reasonable doubt to the trier of fact that the defendant committed the crime, and the burden of proof is upon the defendant to prove by a preponderance of evidence that when he committed the crime he was mentally ill as defined in subsection (A).
(C) The verdict of guilty but mentally ill may be rendered only during the phase of a trial which determines guilt or innocence and is not a form of verdict which may be rendered in the penalty phase.
(D) A court may not accept a plea of guilty but mentally ill unless, after a hearing, the court makes a finding upon the record that the defendant proved by a preponderance of the evidence that when he committed the crime he was mentally ill as provided in Section 17-24-20(A).
As you may guess from this, what constitutes insanity or mental illness of such magnitude as to impact on guilt is defined rather narrowly in the law. One can be stupid, uneducated, have a frightful childhood, and even have delusions, and still it will be no defense nor will it constitute mental illness.
Note that what is required is that the defendant lack the capacity to distinguish between what is morally or legally right from what is morally or legally wrong.
I haven't followed the case, but only note that the test in the law is not what you might expect.