Before disgraced ex-narcotics officer - and star government witness - Jeffrey Walker was sentenced Wednesday to 3 1/2 years in prison, U.S. District Judge Eduardo C. Robreno needed to revisit testimony that resulted in the acquittal of six of Walker's fellow officers.

Walker, Robreno said, was consistent in describing rampant corruption in the Philadelphia narcotics squad. His demeanor was steady, his recollection complete. Others corroborated it.

His supervisors, Sgt. Joe McCloskey and Lt. Robert Otto, were less reliable in questioning Walker's credibility, said the judge. Discrepancies emerged during cross-examination. Walker, it appeared, was punished.

"Once he started cooperating, their view of Walker's performance largely changed," Robreno said in a stunning declaration from the bench. "The court will discount the testimony of his supervisors."

Two months ago, a federal jury chose not to believe the testimony of Walker and drug dealers who leveled accusations of fraud.

On Wednesday, Robreno said the court agreed that the government had failed to meet its burden.

But he showed leniency for Walker, who had pleaded guilty to robbing a drug dealer while on duty.

For about 10 minutes before he was sentenced, Walker, dressed in an olive-drab prison jumpsuit, stood and spoke to the judge. He wiped away tears with a tissue. He lowered his head during long pauses. "I have no excuses," he said.

He apologized to his family. He apologized to Police Commissioner Charles H. Ramsey. He apologized to the people of Philadelphia. And he apologized to the city's police officers: "I made your jobs harder."

Walker will get credit for 26 months already served. After his release in 16 months, Walker will spend three years under supervised release. He was fined $5,000.

Walker, 47, planted drugs inside a South Philadelphia drug dealer's car in May 2013 and later broke into his house to steal $15,000.

He pleaded guilty with one count each of attempted robbery and using a gun during a violent crime in exchange for testifying against his former colleagues in a federal probe into the elite narcotics squad.

"His cooperation was extraordinary," Assistant U.S. Attorney Anthony Wzorek said. "But his crimes were also extraordinary."

Prosecutors saluted Walker for "breaking an institutional code of silence" in testifying against Officers Thomas Liciardello, Brian Reynolds, Michael Spicer, Perry Betts, Linwood Norman, and John Speiser.

Federal sentencing guidelines recommended a prison term of 106 to 117 months. The defense asked for 37 months.

Prosecutors filed their sentencing request under seal, which is common when dealing with cooperating witnesses.

Nevertheless, Wzorek hailed the leniency shown by Robreno, noting in part that it would not discourage officers from revealing future corruption.

"This sentence will have a strong impact on the Police Department itself," Wzorek said.

Inside the large courtroom Wednesday, no witnesses came forward to speak on Walker's behalf. His sister died of cancer May 15, the day of the not-guilty verdict for the six officers who went to trial.

Thomas O. Fitzpatrick, Walker's lawyer, said there were those who supported the officer, but they did not appear in court for fear of police retribution.

Decades ago, Walker's aggressive work earned him a nickname among drug dealers: "Batman." He was described by his supervisors as "a team player."

But Walker, twice divorced, had a drinking problem. Complaints about dubious actions piled up before Internal Affairs. Walker had engaged in criminal activity ever since he joined the force, Robreno said.

Robreno said there were few redeeming qualities to Walker's life. Without his cooperation, he would have been sentenced to the maximum penalty permitted.

The six acquitted officers won back their jobs along with back pay. Five are suing Mayor Nutter, District Attorney Seth Williams, and Ramsey for unspecified monetary damages and a hearing to clear their names.

Their lawyer in a federal complaint filed last week, Christopher Mannix, called the federal case against his clients "literally laughable and disgraceful."

As Walker stood to be handcuffed, he looked around Courtroom 15A and nodded at Assistant U.S. Attorney Maureen McCartney.

"Thank you," he said to her.

"Good luck," she said.

"Thank you."

215-854-2928@MattGelb