A Philadelphia police officer broke down in tears yesterday in Common Pleas Court as he testified that only luck had prevented him from being killed by a gunman who shot him last summer in South Philadelphia.

"I can only imagine my sons coming here and making a victim statement . . . if I was not here," Officer Mark S. Uffelman said at the sentencing of Rakin Thabit, 43, of Camden.

A few minutes later, Judge Denis Cohen sentenced Thabit to 17 to 40 years in prison on charges of attempted murder, robbery, and conspiracy.

Thabit pleaded guilty in April to the June 24 shooting, which wounded one of Uffelman's arms.

Uffelman, 53, and Officer David McAndrews confronted Thabit and Jonathan Massa, 23, also of Camden, about 1:30 a.m. during a robbery at Eighth and Fitzwater Streets.

Thabit and Massa were pointing guns at a man when Uffelman and McAndrews arrived, according to testimony. After Thabit fired at Uffelman, Uffelman chased him and tackled him.

Noting that Thabit had fired six shots at Uffelman from about 10 feet away, Assistant District Attorney Caroline Keating asked Cohen to sentence Thabit to 30 to 60 years in prison.

"Every single bullet in the gun was fired," Keating said. "It's lucky that Mr. Thabit was not a good shot."

After the hearing, Uffelman, who missed months of work due to the shooting, said Thabit should have received a longer prison term.

"I think he got the lower end of the sentence," said Uffelman, the father of 23-year-old twin sons. "It was definitely a sentence that benefits him. I thought he should have gotten a few more years."

Keating said Thabit should have received a tougher sentence. Thabit, she said, was 15 when he was convicted of being with three other men, armed with a shotgun, who robbed and raped a woman whose car had broken down in New Jersey. He served a 15-year sentence, Keating said.

Massa pleaded guilty in April to charges of robbery, conspiracy and possession of a firearm. He faces a mandatory minimum sentence of five to 10 years in prison.

Defense attorney Francis Carmen urged leniency for Thabit, noting that he had been working as a manager of a pizza parlor. Two friends of Thabit's spoke on his behalf, saying he had been a father figure to their children.

Cohen decried the shooting as a "heinous, heinous offense."

"Officer Uffelman is lucky to be alive," the judge said. "It's as if we have seen the return of the wild, wild West."