Justice Eric Macklin found Matthew De Grood, 24, suffered from psychosis which put into question whether he knew the killings were morally wrong.
The court heard De Grood had become withdrawn and started posting online about the end of the world, zombies and Darth Vader a month before the April 2014 attack.
The son of a senior Calgary police officer and a University of Calgary alumnus who was headed to law school, he stabbed fellow alumni at a home in a quiet suburban neighborhood that was hosting a party marking the end of classes.
De Grood will now be detained at a mental health hospital and meet annually with a review board that will determine his eligibility for safe release.
Also Read
Miles Hong, the brother of one of the victims, told reporters outside the courthouse the verdict will be a "recurring nightmare" for the victims' families.
"The end of this trial is not the end of the journey for us. We continue to be broken," Hong said.
"Every year we will be forced to re-live the details of our family (member)'s death and the anguish and sorrow.