A 17-year-old who sexually assaulted an Ottawa librarian was handed a three-year sentence that will see him spend 21 months in jail.

The youth, who can't be named under the Youth Criminal Justice Act, pleaded guilty to aggravated sexual assault at the Metcalfe library in December 2009. A judge handed him the maximum sentence on Wednesday.

His jail term will be followed by 15 months of conditional supervision.

The incident resulted in a complete overhaul of security at Ottawa's public libraries.

The attack was the last call an Ottawa police officer responded to the night he was killed outside the Ottawa Hospital's civic campus.

Const. Eric Czapnik responded to the call and interviewed the victim in hospital. He was later stabbed to death while he was updating his notes in his cruiser outside the hospital.

Kevin Gregson, a suspended Mountie, is charged with first-degree murder in the police officer's death.