SACRAMENTO (CBS13) – Police say that a 26-year-old man has been arrested after an hours-long standoff with officers Sunday morning.

The incident started a little after 11:30 p.m. Saturday, according to the Sacramento Police Department. Officers were called to an apartment on the 100 block of Clauss Court after a neighbor in the area reported hearing gunshots.

READ MORE: El Dorado County Braces For Flooding After Caldor Fire

At the scene, officers announced who they were and knocked on the door of the suspect apartment. However, a suspect inside the apartment reportedly turned off the lights and would not listen to the officer’s commands.

The officers also saw what looked like a gun near the suspect.

A perimeter was soon set up around the apartment. Officers soon got word that two children were inside with the suspect.

READ MORE: Lake Tahoe Wildlife Care Barred From Caring For Bears Until It Makes Changes To Enclosure

With the suspect still not communicating with officers, a Hostage Negotiating Team and SWAT team were also called to the scene.

Police say that contact between officers and the suspect was eventually established and, after about eight hours, the suspect surrendered. The children, said to be age 3 and 5, inside were found to be unharmed and have been placed in protective custody.

A replica BB gun that looked like a real firearm was found inside the apartment, police say.

The man arrested has since been identified as 26-year-old James Edward Duncan. He has been booked at Sacramento County Jail on charges of felony child endangerment and resisting arrest.

MORE NEWS: Kings Home Opener Brings Life To Downtown, Stresses Business