Less than 24 hours after a woman got a restraining order against her estranged husband, he came to her home in San Diego on Saturday and fatally shot her and three of their children before turning the gun on himself, the police said.

When police arrived at the home on Saturday morning, they found the parents and four children — ages 3, 5, 9 and 11 — all with gunshot wounds. The 3-year-old and the parents were dead at the scene, and two of the other boys died at the hospital.

One of the children was in surgery on Saturday afternoon, the police said, adding that they were waiting to identify the victims to give the family time to process their deaths.

Officers raced to the home, in the Paradise Hills neighborhood of San Diego, after someone called 911 shortly before 7 a.m. The caller did not speak, but a dispatcher heard people arguing in the background and someone being asked to leave, Lt. Matt Dobbs of the San Diego Police Department said at a news conference. As officers were driving to the house, a relative of the family who lives nearby called to report that he had heard gunshots.