The man who massacred 51 Muslim worshippers had claimed he was incapable of making rational decisions when he pleaded guilty.