TORONTO — The conviction and 40-year prison sentence for a young mentally ill Canadian who plotted terrorist attacks in New York City should be set aside, his lawyer argues in a new appeal brief.

The brief on behalf of Abdulrahman El Bahnasawy argues that the trial judge violated his rights, and the sentence handed down to him last December was unreasonably harsh.

“The District Court’s sentence of Bahnasawy to 40 years in the custody of an agency that indisputably could not provide him proper care was substantively unreasonable, shocking and at odds with American ideals of fair punishment,” the brief states.

“In relegating the young and impaired Bahnasawy to a virtual life in prison without proper care, the District Court gave lip service, but little more, to all of the mitigating factors that compelled a humane sentence.”

Canadian prisons provide the kind of mental health care that inmates like El Bahnasawy need, while the U.S. Bureau of Prisons does not, according to the factum filed with the U.S. Court of Appeals for the Second Circuit.

Court records show El Bahnasawy was a 17-year-old living at home in Mississauga, Ont., when he met an undercover FBI agent online. The defence argued the agent encouraged him to plan attacks on the Big Apple, while prosecutors maintained the plot was well underway before the two connected.

The FBI, with help from the RCMP, arrested the then-18-year-old El Bahnasawy at a hotel on the outskirts of New York in May 2016. Investigators said he had bought bomb-making materials and helped secure a cabin within driving distance of the city for the purpose of building explosive devices.

El Bahnasawy pleaded guilty to terrorism charges in District Court for the Southern District of New York later in 2016. The plans involved conspirators arrested in Pakistan and the Philippines and called for attacks on the New York subway and Times Square.

The appeal brief argues that Judge Richard Berman was wrong to ignore El Bahnasawy’s right to lawyers of his choice. Despite months of prevarication, the brief states, the young Canadian ultimately told the judge he wanted to be represented by private lawyers, rather than legal-aid lawyers, who wanted to step down.

Berman, however, ordered both sets of lawyers to be “equally responsible” for defending him. That decision, his lawyers now argue, undermined any challenge to the guilty plea he had entered on advice of his public lawyers, and violated his constitutional right to counsel of his choice.

The submission by lawyer Andrew Frisch decries the lengthy sentence Berman imposed despite evidence about El Bahnasawy’s youth, mental illness and severe addictions. The judge, who said the risk of a repeat offence was high, ignored El Bahnasawy’s treatment progress and disavowal of violence, his lawyer says.

“The true risk of a sentence of 40 years on this especially robust record is not that the maturing Bahnasawy might one day conspire again, but that we do irreparable harm to the ideals most likely to keep us safe,” Frisch states.

In a letter previously filed with the District Court, El Bahnasawy said he was motivated by American air strikes in the Middle East and expressed regret.

“There are many issues in this world but I don’t want to lose my life or freedom to try fixing them, and I definitely do not want to resort to violence or harm to fix them,” El Bahnasawy wrote. “I sincerely apologize for my (behaviour) and I only ask for a second chance.”