Jeffrey Thomas had used the handgun he shot a police officer with Saturday to commit at least one robbery, according to Buffalo police.

And when officers received a tip of “a man with a gun” standing at a University District bus stop, it came from someone apparently looking to settle a score with Thomas. That set in motion a chain of events ending in a “close call” for Officer Joseph R. Hassett.

Hassett, a housing unit officer, was released from Erie County Medical Center on Saturday night, just hours after he was shot in the right knee in a yard on Eldon Road, near Eggert Road. Doctors discharged him with the bullet still in his leg, believing it would cause more damage if it were removed, police said, adding that the slug caused a hairline fracture to Hassett’s thigh bone.

Thomas suffered a minor flesh wound to his right hand from the bullet before it struck the officer, according to a police report.

Hassett, even though he was wounded, was able to climb a 5-foot chain-link fence and subdue Thomas long enough that his partner, Officer Bart Adams, could handcuff him.

Police officials say there are indications that the tip received on Thomas, 22, who recently moved from Buffalo to West Seneca, was called in by someone he had robbed of drugs.

Before Saturday’s shooting, police say they were familiar with Thomas from minor crimes in the past.

Four years ago, he was arrested in a late-night robbery attempt in Cheektowaga’s Pine Ridge neighborhood. The victim said robbers put a gun to his head.

Last summer, Thomas’ brother, Jeremy, 23, was shot in the head and chest on Sumner Place by a teenager on a bicycle. He died two weeks later. Damone Lewis, 17, of Gibson Street, was indicted in November on murder charges for the death of Jeremy Thomas.

Police say Jeffrey Thomas pulled out his .22-caliber Smith & Wesson pistol and ran when housing police arrived on Eldon Road, on the border with Amherst and Cheektowaga, at about 5 p.m. Saturday.

Other officers praised Hassett’s tenacity.

“You have to give Joe credit. He was shot as he approached the fence Thomas was climbing. Joe still hopped the fence and tackled him,” said one of the officers who responded to the call of an “officer down.”

Police Commissioner Daniel Derenda said Hassett demonstrated bravery.

“It highlights the dangers that each of our officers face every day. This officer, with total disregard for his safety, chased the suspect who had a gun in his hand, and even after he was shot, continued over the fence, not realizing he’d been hit,” Derenda said.

Thomas was charged with first-degree assault and second-degree criminal possession of a weapon. An investigation to determine how he obtained the pistol, which was not reported stolen, is continuing.

In addition to Hassett and Adams, Officers William Macy and Will Robinson, also of the housing unit, participated in the pursuit of Thomas, who is scheduled to return to City Court at 9:30 a.m. Friday.