A fight at a holiday party turned into a scene of mass carnage in an LA suburb on Wednesday as a man who stormed out of the festivities returned with two pals and opened fire on the crowd, killing 14, sources said.

Another 17 were seriously wounded by the masked shooters, who were dressed in army fatigues and used rifles to spray bullets at the helpless victims.

The gunmen sped off from the busy Inland Regional Center in a black SUV.

Hours later, cops caught up with the vehicle — and the men lobbed pipe bombs during a chase that ended when the Yukon Denali was finally surrounded on a quiet San Bernardino street.

The vehicle was riddled with bullets in a shootout that left one man and one woman dead.

A third was still at large on Wednesday evening, and cops were going door to door in the residential area, which was placed on lockdown.

Authorities said the gunmen thought through the massacre before heading to the large facility around 11 a.m. local time.

“Preliminary information indicates that these were people that came prepared, that they were dressed and equipped in a way to indicate that they were prepared,” San Bernardino Police Chief Jarrod Burguan said at a press conference.

“And they were armed with long guns, not handguns.”

The bloodbath happened inside the largest conference room at Inland — a state-run facility with hundreds of employees that provides services to people with developmental disabilities.

Without warning, the gunmen fired away at a group of San Bernardino County Department of Public Health officials, who were holding the banquet, according to Inland board president and chief executive Marybeth Feild.

There did not appear to be any victims elsewhere in the facility.

“It’s my understanding that most of the people that were wounded, most of the victims, were all centrally located in the facility,” Burguan said.

“They came in with a purpose — they came in with an intent,” he said later of the cold-blooded killers.

Terrified social workers locked their office doors, hid in bathrooms and ducked under desks as gunshots rang out through the massive building. Several people texted loved ones as they sought cover.

The shooters were not immediately identified, and they left no weapons at the scene.

But a rifle with a black nylon case was found on Waterman Avenue.

Meanwhile, the sidewalks and streets outside the center were a bloody, chaotic mess, with victims being treated on the ground as others on stretchers were placed in ambulances.

Dozens of people left the building in single-file lines with their hands up.

Most of the evacuated employees were taken to the Rock Church & World Outreach Center in San Bernardino.

Some of the wounded were being put in the back of pickup trucks to be taken to local hospitals.

Arrowhead Regional Medical Center reported taking in six patients, while Loma Linda University Medical Center said they were treating another six.

Hordes of law enforcement members descended on the facility in the aftermath of the tragedy — spending hours evacuating the center and sweeping for explosives.

A bomb squad detonated one suspected explosive device using a robot, according to a federal law enforcement official.

Burguan described the shooting as a “domestic terrorist-type situation.”

The neighborhood where gunfire erupted includes a golf course, an office park and a school.

The shooting was the deadliest act of gun violence in the US since the Newtown, Conn., massacre at Sandy Hook Elementary School, where 26 innocent victims were killed in December 2012.

The shooter, Adam Lanza, then killed himself.

Additional reporting by David K. Li