Philadelphia police say Officer Kollin Berg of the 39th District was on patrol alone Wednesday when he heard 10 to 15 gunshots in rapid succession.
He came up 20th and saw a man police now identify as 39-year-old Eric Barnes firing the assault rifle into the air.
Police say he'd already fired off 30 rounds and had a dozen more ready.
Officer Berg approached with his weapon drawn.
"I immediately announced 'police, drop the weapon.' About the second time I yelled it, he was just looking over his right shoulder. As he looked over his right shoulder, I was in 8 to 10 feet of him. I think he realized me coming out of nowhere, I had the drop on him and he immediately dropped his weapon," Berg said.
"I think it's an example of unbelievable restraint on the part of the officer." Philadelphia Police Commissioner Charles Ramsey told WPVI TV.
On Thursday, Officer Barnes received high praise from the top brass for neutralizing the situation and for saving lives including the suspect's.