A suspect wielding a loaded .45-caliber handgun was taken into custody and a baby inside was reunited with its mother after an hours-long standoff in San Ysidro Sunday, San Diego Police (SDPD) said.

The standoff began at approximately 8:16 a.m. Sunday when Nicholas Schaefer, 25, showed his girlfriend a gun and acted in a threatening manner, SDPD officers said.

"He pulled out a handgun, waved it in a threatening manner so the female ended up leaving the apartment, went down the street and called police and that’s when we responded," said SDPD Capt. Alberto Leos.

The pair were inside an apartment near Camino De La Plaza and Willow in San Ysidro, officers said. The location is across a popular outlet mall.

Police responded to the scene to talk to Chaffer; the SWAT team responded shortly after.

"Because of the threats with the handgun and the acts that the suspect was displaying, we ended up calling our swat team out to contain and de-escalate the situation," Leos said.

For several hours, Chaffer refused to come outside, police said. The incident prompted officials to evacuate nearby apartments as they worked.

However, shortly before 12 p.m., Chaffer surrendered to police.

No one was injured in the incident; the child was reunited with its mother, police said. A loaded .45 handgun was recovered as well, police said.

"It’s a win win situation here," said Leos. "These are the type of missions that we all want to see. No one is harmed, no one is injured and the suspect gives up peacefully and we can just move forward."

SDPD's Domestic Violence Unit is investigating. Schaefer is in jail and faces domestic violence charges.

No other information was available.