The man on trial for murdering a clerk at a grocery store admits to killing her, but said he did so because he was mentally ill.

Randy Tshilumba, on trial for the first-degree murder of Clemence Beaulieu-Patry, took the stand Thursday to testify in his own defence.

Before he did so his lawyer, Philippe Larochelle, told the jury that he plans to demonstrate that Tshilumba has a mental illness and was delusional when he killed Beaulieu-Patry.

"His psychological problems existed before the murder," Larochelle said. "Mental illness is not always visible."

He said that two psychiatrists, as well as Tshilumba's family and friends, will explain the defendant's state of mind.

Tshilumba began his testimony by saying he suffered from anxiety and depression, and that following a random encounter with Beaulieu-Patry and her friends, become convinced they were stalking him.

He said this feeling was emphasized by postings he read on Facebook.

Tshilumba said he stopped taking his prescription medication because he became convinced that his doctor was working with Beaulieu-Patry and her group.

He said he went into the Maxi grocery store on Sunday April 10, 2016 because he believed that Beaulieu-Patry and her friends were trying to kill him or other people.

Tshilumba testified that when he confronted Beaulieu-Patry he was convinced she was about to pull out a gun and shoot other people in the store, and so he stabbed her several times. In court, Tshilumba said he believe he stabbed her five or six times. A pathologist counted 14 stab wounds.

"I defended myself and I defended the other clients," Tshilumba said. "She wanted to kill me and other clients."

He explained that the knife he used was the second he had acquired -- that his mother had found the first knife he purchased and confiscated it, so he bought a second weapon and kept it hidden.

He will resume his testimony Friday.

With files from The Canadian Press