A court in Israel has sentenced a Palestinian man to 18 years in jail for fatally stabbing a British student, Hannah Bladon, in Jerusalem, under a plea bargain that acknowledged he is mentally ill.

Jamil Tamimi, 59, killed the 20-year-old University of Birmingham exchange student on a tram in April 2017 as she travelled to a church where she volunteered. He had chosen her at random when she got up to offer her seat to another woman, the court heard.

The carriage, travelling near the Old City, was packed with people at the time of the incident as Christians marked Good Friday and Jews celebrated Passover. Bladon died in hospital soon after she arrived.

Palestinians have carried out similar politically motivated attacks in Jerusalem. The Israeli police spokesman, Micky Rosenfeld, originally blamed an “Arab terrorist” from east Jerusalem, but the court agreed the defendant had a mental illness.

“This was not a terrorist incident ... This was a terrible murder carried out by a mentally ill person,” the prosecutor said in their explanation of why a life sentence had not been sought, according to a court transcript.

Tamimi’s lawyer said his client attacked Bladon in anger after his sons insisted he remain in a mental institution, and he had hoped the knifing would spur an Israeli to shoot him dead.

Bladon’s relatives criticised the sentence as too short. The Israeli lawyer Maurice Hirsch, the family’s representative, said: “They are outraged by the leniency of the sentence. They expected that Hannah’s murderer would spend the rest of his life behind bars.”

Tamimi was quoted by a court transcript as saying he was sorry: “I wish I could take her [Bladon’s] place. I did not mean to murder her. I don’t know how it happened.”

Bladon was studying for a degree in religion, theology and archaeology. Her family described her as a talented musician, part of a serving team at her local church and a member of her local archaeological group.

“She was driven and passionate and her death leaves so much promise unfulfilled. Our family are devastated by this senseless and tragic attack,” they said.