A young man in Canada who stabbed five people to death at a house party displayed erratic behaviour in the weeks leading up to the incident, telling friends the world was about to end and posting messages online about killing vampires.

The trial of Matthew de Grood, 24, began on Monday, more than two years after an end-of-semester house party in Calgary, Alberta, turned fatal. De Grood is facing five counts of first-degree murder in the city’s worst mass killing.

De Grood has pleaded not guilty to all of the charges but admitted in an agreed statement of facts that he had stabbed the victims.

Lawrence Hong, Joshua Hunter, Kaitlin Perras, Zackariah Rathwell and Jordan Segura – all students who ranged in age from 22 to 27 – suffered multiple stab wounds.

The trial is being followed closely across the country, and much of it is expected to focus on the mental state of De Grood at the time of the killings. On Monday, the court heard that his friends and family had noticed changes in his behaviour in the weeks leading up to the attack, including erratic posts on Facebook and paranoid, rambling text messages sent to his parents and coworkers.

De Grood’s father, a high-ranking official with the Calgary police service, and his wife had worried about their son’s seemingly deteriorating mental health and briefly considered obtaining a mental health warrant to have him taken into custody. He had struggled with drug use in the past and family members were concerned he might be using drugs again.

Prior to the stabbings, De Grood, who had just finished a bachelor of science in psychology and had been accepted to law school, told one friend that the world would end at midnight and another that US president Barack Obama was the antichrist.

Police were later called by guests at the party to a rented home near the University of Calgary campus. They found three men already dead. A fourth man was found collapsed on the front lawn, while a woman inside the house was also injured. Both were taken to hospital, where they later died.

De Grood was arrested near the home. Police found a clove of garlic stuffed in his sock and another one tucked in his jacket pocket, the court heard. “It was to keep the zombies away,” De Grood told police. “I’m sorry. I had to kill them,” he added.

He made other bizarre comments to the officers, telling them he was an alien and had been born in an incubator. He was taken to hospital, where doctors noted that “he was psychotic and had no insight into his illness”, according to the agreed statement of facts.

Prior to the start of the trial on Monday, Gregg Perras, the father of one of the victims read a statement on behalf of the victims’ families. “All we ask is that you remember how they lived: full of purpose, full of life, full of goodness, and love for their friends and family,” he said as he choked back tears. “Their deaths and this tragedy do not define them.”