ORANGE, Calif. — The gunman who killed at least four people, including a 9-year-old boy who died in the arms of a fatally wounded woman, locked his targets into the office compound just before closing time as he set off on his rampage, police said.

The early details that emerged Thursday suggested that the motive for the Wednesday evening shooting here southeast of Los Angeles may have been personal in nature. Orange County law enforcement officials described the suspect, 44-year-old Aminadab Gaxiola Gonzalez of nearby Fullerton, as having a “personal or business relationship” with the victims.

Law enforcement officials declined to provide the victims’ names — two women, one man and a child — or their relationship to Gonzalez, citing a complicated early investigation and crime scene. Two of the victims were found in offices rented by Unified Homes, which sells mobile homes in Orange County. Another female victim also remains in the hospital, in critical condition, after being wounded in the attack.

“This was not random,” said Orange County District Attorney Todd Spitzer, who noted that the killing of multiple victims, and that Gonzalez — because he allegedly locked the gates — may have been “lying in wait” to carry out the crime, could make him eligible for the death penalty if convicted.

Officials said Gonzalez, who is being treated in the hospital for injuries sustained during the incident, used a semiautomatic pistol to commit the killings. Orange police released a photo of him inside the building, wearing a black bandanna over his lower face, a baseball hat and sunglasses obscuring the rest of it, and a backpack slung over a shoulder.

Investigators have not determined whether Gonzalez was shot by police, who recovered the backpack containing handcuffs and pepper spray, or whether the wounds were self-inflicted. They also did not disclose a motive, or how the shooter may have purchased the weapon, as crime scene technicians worked inside the office suites.

But, Spitzer added, “I will not be rushed,” alluding to what he said were investigative mistakes made after the 2011 mass shooting in nearby Seal Beach, where a 41-year-old man angry over child custody arrangements shot eight people dead in a beauty salon.

Spitzer said the mishandled investigation made it impossible for prosecutors to seek the death penalty against the shooter, Scott Dekraai, who was eventually sentenced to life in prison.

“We’re not going to make mistakes,” Spitzer said.

The Orange killings, which unfolded in the twilight hours of Wednesday evening at a squat office park in this heavily urban area of the Los Angeles metroplex, marked the nation’s third mass shooting in March, even as much of the country has begun feeling optimistic again with ebbing influence of the coronavirus pandemic.

On March 16, a 21-year-old gunman shot dead eight people at three Atlanta-area spas, six of them Asian American women. Less than a week later, a 21-year-old gunman walked into a King Soopers grocery store in Boulder, Colo., and opened fire, killing 10 people.

The shooting Wednesday was the worst in this city since 1997, when a Caltrans employee killed four co-workers, including his former boss, after being fired by the state highway agency six weeks earlier. The man was killed by police.

“Orange is a very safe city,” ­Orange Police Department Lt. Jennifer Amat told reporters. “We don’t have stuff like this that happens very often.”

The Orange shooting may diverge from March’s other mass killings in that officials are saying the shooter knew his victims. There is little evidence so far in the two previous mass shootings of such relationships.

Police received reports about shots fired around 5:30 p.m. local time at a two-story building in Orange that houses multiple commercial offices. Officers responded to the scene within two minutes of the call and immediately encountered gunfire, Amat said, adding that the shooting took place throughout the complex.

On Thursday, officials said that when police officers arrived at the scene, they found the gates to the office park locked with bicycle chains. The officers used bolt cutters to enter the compound.

“I’m deeply saddened by reports of a mass shooting in Orange County, and I’m continuing to keep victims and their loved ones in my thoughts as we continue to learn more,” Rep. Katie Porter (D-Calif.) said on Twitter.

California state Sen. Dave Min (D) said he was “heartbroken” to hear about the shooting, which happened just after he took his daughter to a medical appointment only a few miles away.

“This is the America we live in today,” he wrote on Twitter. “It’s an America where we have become so inured to the constant drumbeat of gun violence that we all just wearily accept the idea that any of us, at any time, for any reason, can be the victim of gun violence.”

He pledged to push for measures to reduce gun violence, adding: “Enough is enough.”

In a statement, Gov. Gavin Newsom (D), said: “Horrifying and heartbreaking. Our hearts are with the families impacted by this terrible tragedy.”

Police said Gonzalez, who has been staying in an Anaheim motel room, arrived at the beige office complex in a rented car. The building is located in northern Orange County, near the intersection of two main thoroughfares.

On one side of the building are single-family homes, an auto-body shop across the street.

Camilo Akli, 28, who lives near the complex and frequently walks his dog around the neighborhood, said he has seen small real estate companies and insurance agencies “come and go” from the building, which has always seemed quiet.

“I’ve walked around there for years,” he said.

The pink house at Anaheim Royal mobile home park where Gonzalez usually lived was quiet Thursday afternoon.

Gonzalez lived at the home with his 9-year-old son and girlfriend, who neighbors say are both victims of the Wednesday night rampage, although police officials declined to confirm that. His girlfriend’s 19-year-old daughter, Karla Palazuelos, also lived there, according to neighbors, as well as at least one other woman who rented a room in the home.

Bagged old newspapers and Christmas decorations in boxes sat on the porch, and a child’s scooter, a bike with training wheels and a tricycle were parked outside the home’s small shed, ready for use. A blue Honda minivan sat in the driveway. Inside, there was a red sippy cup on a wooden dining table.

Residents of the mobile home park, wedged next to a freeway on-ramp and just a few miles north of Disneyland in Anaheim, Calif., were stunned to find out that the family who lived there were involved in the shooting they had read about the night before.

“I’m in shock. I can’t believe it,” said one resident, Rosa, 36, who spoke on the condition that her last name be withheld. “That’s why it’s been so quiet. I haven’t seen anyone since yesterday.”

Rosa said she lives diagonally from the mobile home and described Gonzalez as a “respectful” and friendly family man who was frequently spotted walking around the neighborhood with his young son and small white dog.

“Most of the time he was just walking with his kid. He’s a nice guy, he’s not one of those types that will come and talk mean to you,” she said. “He’s not a bad guy. I used to have a chile tree. He would come and talk to us and ask to get some, and we were like, ‘Yeah go for it.’ ”

“He’s a really quiet guy and he’s really respectful. He’s really friendly. Always with the dog and the kid walking around the neighborhood,” she said.

Rosa said the mother often cooked food and sold it to neighbors.

“They used to sell tamales, they used to sell food. I went a couple times to her house to buy it,” she said.

She confirmed that the man they knew was the man depicted in the photo released by police. “I saw the picture just now and I was like, ‘I know that guy.’ ”

Rosa’s younger sister was childhood friends with Palazuelos, and they frequently hung out together, she said.

Other neighbors described the household as quiet, filled with people who largely kept to themselves. No one could recall the little boy or his mother’s name, but they said the family had probably been living there at least 10 years.

“Oh my god,” said Manuel, 70, a neighbor who asked that his last name not be included when he learned that the alleged shooter lived across the street from him. “Unfortunately, I see them once in a while, but I don’t know anything about the family. We’re an independent neighborhood, this facility has over 100 homes. I think we know just one or two families and that’s it.”

Wilson reported from Santa Barbara, Calif. Teo Armus in Washington contributed to this report.