A Canadian awaiting sentencing for plotting terrorist attacks in New York City for the so-called Islamic State is being treated with antipsychotic drugs, according to a court transcript obtained by Global News.

“I see a psychiatrist in the jail and I take the antipsychotic Geodon,” Abdulrahman El Bahnasawy, a 19-year-old from Mississauga, Ont., told the judge at a U.S. District Court hearing two weeks ago.

Geodon is the brand name for ziprasidone, which is used to treat symptoms of schizophrenia and bipolar disorder. El Bahnasawy said he took the drug daily. He had no other medical conditions and was not seeing any other doctors, he said.

The testimony offered new details about the mental state of the Kuwait-born Canadian, who has admitted the targets of the planned terror attacks were Times Square and the New York subway system.

El Bahnasawy spoke about “hallucinations” at a previous court sitting, according to documents obtained by Global News, which first reported on his unspecified mental health issues.

When he pleaded guilty to terrorism conspiracy charges on Oct. 13, 2016, El Bahnasawy, his lawyer and a federal judge all agreed he was competent. But his mental health could be a factor at his upcoming sentencing.

He faces a possible life sentence.

El Bahnasawy came to the attention of U.S. authorities after he began corresponding online with a man he thought was an extremist but who was actually working undercover for police.

“These Americans need an attack … I wanna create the next 9/11,” El Bahnasawy wrote. His “main intention,” he wrote, was “to please Allah by dying for him.”

The attacks were to occur in June 2016, during the Islamic holy month of Ramadan, U.S. authorities said. El Bahnasawy purchased bomb-making materials in Ontario and sent them to the informant.

The FBI arrested El Bahnasawy in New Jersey in May 2016. Five months later, he pleaded guilty but the case was kept under seal until last month, when an alleged co-conspirator was arrested in Pakistan and the suspected financier was taken into custody in the Philippines.

El-Bahnasawy’s use of antipsychotics came up at a Nov. 7 hearing to decide whether to allow him to drop his federal defenders and bring in new lawyers, including Dennis Edney of Edmonton, who represents Omar Khadr.

Previously, El Bahnasawy had written to the judge to say he did not want Edney to visit him and that he wanted to keep his attorney, Sabrina Shroff. But on Sept. 24, he wrote that his parents were “very distressed and sad” that he had not taken on Edney and two other lawyers.

“My mom was crying and begging me,” he wrote.

But he told the judge at the hearing he was not satisfied with his legal representation and denied his change of heart was the result of pressure from his parents. “I just stopped liking the federal defenders,” he said.

Edney told the court the parents had approached him about a year ago for advice on their son’s case. He said he had visited El Bahnasawy three times and had encouraged him “quite strongly” to cooperate with the FBI.

He said his role was to give advice about steps he could take under the treaty that allows Canadians convicted in the U.S. to transfer to Canadian prisons.

Edney said he had contacted El Bahnasawy’s lawyer but “our conversation didn’t go well.” He said she “screamed at me on the phone” and he eventually “withdrew from further communications with her.”

He said El Bahnasawy told him he was being “pressured” by his lawyer. “He told me that he was told by Ms. Shroff that I was a bad lawyer,” Edney told the judge.

El Bahnasawy also said Shroff had concerns about a former Guantanamo Bay psychiatrist that Edney wanted to introduce to him. “He told me that Ms. Shroff stated that that psychiatrist was not well thought of.”

Shroff said that because the case was sealed at the time, she was not permitted to discuss it with Edney. “We made sure to represent Mr. Bahnasawy to the best of our abilities,” she said.

She also said she had retained a different Canadian lawyer, John Norris, “to make sure that Mr. Bahnasawy’s interests in Canada were properly evaluated and properly taken care of.”

The judge denied the request to change lawyers and gave El Bahnasawy more time to think about it. The matter was scheduled to return to court on Tuesday. A change in lawyers would likely delay sentencing, which had been set for Dec. 12.