“This is not pleasant and this is not easy,” Judge Gaughan said in delivering his ruling.

Mr. Van Dyke’s sentencing comes only one day after the acquittals of three fellow police officers who were accused of attempting to cover up his crime, a ruling that left many Chicagoans stunned and furious. And even with Mr. Van Dyke’s conviction and sentence, there remained an unsettled question in Chicago of whether anything in the police department — and what many see as a decades-old “code of silence” in which officers conceal and conspire to protect their own — had really changed.

For several hours in a cramped courtroom on Friday, residents who had filed complaints against Mr. Van Dyke years ago testified for the prosecution about those encounters. One man said he had been called the N-word. Another cried and said he had to undergo surgery after being manhandled. Another, a young black man who said he was wrongly arrested, chuckled and said, “He’s definitely in the right attire” when asked to identify Mr. Van Dyke in the courtroom.

Mr. Hunter, the spokesman for the McDonald family, told Judge Gaughan how he had used Laquan’s final paycheck from his construction job, issued four days after his death, to buy the suit the teenager was buried in.

“Please think about me and about my life when you sentence this person to prison,” Mr. Hunter said in court, reading a statement written from the perspective of Laquan. “Why should this person who has ended my life forever because he chose to become judge, jury and executioner — and has never asked for forgiveness — be free when I am dead.”

Mr. Van Dyke, who has grown a patchy beard and become noticeably thinner since going to jail, sat expressionless throughout much of Friday’s testimony. He wore a faded yellow jail jumpsuit. And when he entered and exited the courtroom, he clasped his hands behind his back, flanked by sheriff’s deputies.

Jurors convicted Mr. Van Dyke in October of second-degree murder and 16 counts of aggravated battery with a firearm, one for each bullet he fired. Prosecutors asked Judge Gaughan to sentence him to at least 18 years in prison. Mr. Van Dyke’s lawyers suggested probation.

Just before learning his sentence, Mr. Van Dyke rose and read a short statement.

Shooting Laquan was “the last thing I ever wanted to do,” said Mr. Van Dyke, who spoke softly and read from a piece of paper. “People have the right to judge my actions, however no one knows what I was thinking in that critical moment.”