A Chicago police officer shot a man during a foot chase that ended inside an East Chatham apartment building Wednesday night.

A little after 7 p.m., officers on “proactive patrol” saw a man with a gun standing in a crowd near 79th Street and Drexel, according to Chicago Police Patrol Bureau Chief Fred Waller.

Three officers tried to stop him, but he ran about a block and forced his way into the third floor of an apartment building at 79th and Ingleside, Waller said.

A “brief struggle ensued” and one of the officers shot the man once, Waller said.

He was shot in his upper body, police said. Thought to be in his early 20s, he was listed in serious condition at the University of Chicago Medical Center. Charges against him were pending Thursday afternoon.

Police said they recovered a handgun with an extended magazine from the suspect, who did not fire the weapon, Waller said. Chicago police spokesman Anthony Guglielmi tweeted out a photo of the gun recovered.

Residents were inside the building at the time of the shooting but no one else was hurt, Waller said.

The officers were taken to the hospital for observation as a precaution. They’ll be placed on desk duty for a month per CPD policy as the Civilian Office of Police Accountability investigates the use of force.