An unidentified man was shot and killed by a police officer after he allegedly threatened the officer with a pellet gun in South Philadelphia last night, a police spokesman said this morning.

The alleged perpetrator was shot once in the torso around 11:20 p.m. in the area of 23d and Cross Streets by a 17th Police District officer, said Lt. Frank Vanore. The man was taken to the Hospital of the University of Pennsylvania and pronounced dead at 11:43 p.m.

Police recovered a black pellet gun at the scene, Vanore said.

The incident began when two men exited Lids Cafe Society bar at 23d and Tasker Streets and were walking north on 23d when they began to argue, Vanore said.

One of the men approached the officer who was seated in a patrol car nearby and asked for assistance, Vanore said.

When the officer tried to intervene in the altercation, one of the men "made some verbal indication that he was going to shoot the officer," Vanore said.

The officer warned the individual several times to drop his weapon. The man refused and made a threatening gesture, Vanore said. The officer fired once.

The incident is under investigation by Internal Affairs Bureau.

Earlier this year, a man was murdered after he walked out of the same bar following an argument inside with a woman. The woman was arrested in the case.

Contact staff writer Robert Moran at 215-854-5983 or bmoran@phillynews.com.