The incident happened around 10:42 p.m. Saturday at 51 N. Powelton Avenue.
Prior to entering the hospital for detail, police said the 18th District officer was approached by a 40-year-old black male who stated, "I'm hungry. I haven't eaten in five days. Do you have any money to spare?" The officer handed the man a $5 bill and entered the facility.
Sometime after, police said the officer returned to the entrance of the emergency room near the exit doors. While his back was turned, the same man who approached him earlier attempted to retrieve the officer's handgun from his holster.
A brief struggle ensued and, with the assistance of Penn security and other officers, the officer was able to subdue the man and prevent him from obtaining the handgun.
Police said once in custody, the man told them he wanted the gun to carry out a robbery at a store.
The officer was unharmed during the incident. The man sustained a minor facial injury.
Police said the officer was working detail for Officer Hartnett, who was wounded in the line of duty on Jan. 7. Edward Archer, 30, of Yeadon is facing multiple charges in the incident.
The incident is not related to the shooting of Officer Hartnett, police said.