PITTSBURGH (AP) — East Pittsburgh Police Officer Michael Rosfeld did everything by the book in his fatal encounter with an unarmed black teenager outside Pittsburgh last summer, a defense expert says.

Testifying at Rosfeld’s homicide trial, retired Pennsylvania State Police Trooper Clifford W. Jobe Jr. maintained Rosfeld followed proper procedure when he shot and killed 17-year-old Antwon Rose II. Prosecutors say Rosfeld gave inconsistent statements about the shooting, including whether he thought Rose had a gun.

“I can’t fault Officer Rosfeld,” Jobe, a use-of-force expert, told jurors on Thursday. He called the officer’s actions “textbook.”

As Jobe returned to the stand Friday for cross-examination, the judge lifted a gag order he imposed on parties in the case at the request of the defense. Defense attorney Patrick Thomassey said while he and prosecutors have abided by the judge’s order, the attorney for Rose’s family has not. On Wednesday, S. Lee Merritt released a letter to the media that Rose’s mother wrote to prosecutors urging them to show what a “kind, loving and funny” person her son was.

Rosfeld, 30, fired three bullets into Rose after pulling over an unlicensed taxi that had been used in a drive-by shooting. Rose, a passenger in the car, was shot in the back, arm and side of his face as he was running away.

Rosfeld testified Thursday he thought Rose or another passenger in the car had pointed a weapon at him, and he fired in self-defense. But it turned out that neither teen had a gun at the time.

“It happened very quickly,” said Rosfeld, who took the stand in his own defense. “My intent was to end the threat that was made against me. I just wanted to end the threat to me. I followed the threat and fired.”

Rosfeld got choked up and dabbed away tears as he recounted finding the mortally wounded Rose on the ground.

“I was upset, shocked,” he said. “He was moaning, trying to breathe.”

The former officer testified after the prosecution rested its case Thursday.

A prosecution witness has said that after the shooting, he heard Rosfeld say repeatedly, “I don’t know why I shot him. I don’t know why I fired.” But another prosecution witness said he heard the officer ask, “Why did he do that? Why did he take that out of his pocket?”

Prosecutors charged Rosfeld with an open count of homicide, meaning the jury can convict Rosfeld of murder or manslaughter.

Rose had been riding in the front seat of the cab when another occupant, Zaijuan Hester, in the backseat, rolled down a window and shot at two men on the street, hitting one in the abdomen. A few minutes later, Rosfeld spotted their car, which had its rear windshield shot out, and pulled it over.

Hester, 18, pleaded guilty last week to aggravated assault and firearms violations. Hester told a judge that he, not Rose, did the shooting.