It started around 1 am at the Avery Apartments on Barstow Avenue and Fresno Street.
Police responded to reports of someone armed at the four-story complex.
When officers arrived, they didn't find anyone who was armed, but they did speak with a man over the phone who was possibly involved in the incident.
After speaking with him, the officers determined he wasn't an immediate danger to himself or others, and they left the complex.
An hour later, investigators received several calls about a man who was firing a gun into the air. As the officers arrived, they heard multiple gunshots fired from the complex.
Officers surrounded the building, and those inside the California Highway Patrol helicopter were able to speak to the man over a PA speaker.
Police say several more shots were fired while officers were on the scene.
Two hours later, the suspect eventually dropped his weapon and surrendered to the police.
No one else was in his apartment, and no one was hurt.