James Rogers is escorted from provincial court in St. John's after being sentenced to a federal prison. (CBC )

A man who had been mentally ill when he slashed a stranger's throat in downtown St. John's last summer was sentenced to prison Thursday.

James William Rogers, 36, was given a 4.5-year sentence for convictions that included aggravated assault and possession of a weapon.

Rogers had pleaded guilty to using a box cutter to slash the throat of Brock Walker near Harbourside Park, off Water Street.

Judge Lori Marshall noted that Rogers had mental health issues that had never been properly diagnosed or treated.

Marshall said she viewed the attack as well as an earlier robbery as cries for help.

While the Crown had asked for a sentence of 7.5 years, Marshall said punishment was not her priority. Instead, she wanted Rogers to be able to obtain appropriate treatment at a federal prison.

Rogers has already served the equivalent of one year of his sentence.