Four boys were rescued by police from their father in a standoff on a San Diego highway overpass, just hours after their mother's body was found in the trunk of a car.

On Thursday, officers arrested the husband, Daniel Perez, after an Amber Alert was triggered for the children. Police found him and a dramatic hour-long standoff on the California bridge ensued, where the man reportedly considered tossing one of the boys off the ledge. Authorities were able to rescue the young sons after they shot their father with a bean bag, reports NBC San Diego

Perez' wife's body was found in Montebello on Wednesday after she and her family were reported missing last week Tuesday. Nobody had seen the family since Dec. 5. She was found inside the trunk of the family's Honda Accord. The body was identified as that of Erika Perez on Thursday afternoon.

The new discovery prompted police to trigger an Amber Alert for the missing children in the family's black 2014 Toyota Camry. Investigators learned that the car had activated its lojack system Wednesday evening, according to Montebello police officer Lt. Julio Calleros. They activated the system, and at 8:20 a.m. Thursday, the lojack placed "a hit" in the Fletcher Hills area.

As El Cajon police approached the Camry, Perez began to drive away. Police said they pursued him for nearly 20 minutes before he stopped on a transition road at 9 a.m. Two of the boys in the car ran out to police, and a crisis negotiator talked with Perez as he began walking to the edge of the bridge.

SWAT vehicles and more than 10 police cares closed in as the negotiator spoke to Perez on a cell phone. He held one child's hand and another boy followed him to the edge.

"We were fearful, based on his statements, that he may try to throw the children off the bridge or himself, so we had to take action at that point," Capt. Moss said to NBC San Diego.

That's when officers shot Perez once with a non-lethal bean bag gun and were then able to take him into custody. No one was seriously injured.