After one or more attackers opened fire at a social services facility in the Southern California city of San Bernardino, people taking cover in the building sent frantic texts to their loved ones.

Reports of gunfire came at approximately 11 a.m. local time, sending police and other law enforcement to the scene of the Inland Regional Center in San Bernardino.

Police said Wednesday afternoon that at least 14 people were killed, and several hundred evacuated from the building.

Terry Petit told reporters he received a text from his daughter saying she was hiding after gunfire broke out.

According to Petit, his daughter wrote: “People shot. In the office waiting for cops. Pray for us. I am locked in an office.”

Police searched people as they filed out of a building with their hands up. Some were being reunited with loved ones who raced to the scene as news of the shooting unfolded.

Marcos Aguilera, whose wife works at the centre, was first alerted to the shooting in a text she sent, telling him she and others had locked themselves in her office.

“She said, ‘I love you,’ and I came over here,” Aguilera told reporters outside the facility.

Aguilera, who spoke with his wife by phone, said she described hearing shots as a “guy” came in next to her office.

“They’ve seen bodies on the floor and she said right now ambulances are taking people out in stretchers,” Aguilera said.

A tearful Olivia Navarro told reporters that her daughter was also holed up inside the building in the immediate aftermath of the shooting.

“She was whispering,” Navarro said. “I think she didn’t want anyone to hear her if they were outside in the hall.”

Navarro said someone “turned off the lights in the department and locked the door” to make it seem as if no one was in the room.

“That’s all that she told me and then we stopped talking because I didn’t want her to talk anymore,” Navarro said, adding she later received a text from her daughter, who is now believed to be safe.

Paul Lacroix said that his son, who was also inside the social services centre as gunfire erupted, texted him and told him that alarms started going off in the building. He then got word that there had been a shooting.

Lacroix said his son and his co-workers were ordered to exit the building with their arms up and nothing in their hands.

People working not far from the facility also witnessed the chaos unfold as police and emergency vehicles raced to the scene after reports of an active shooter.

The manager of a Shell gas station located approximately one block from the building estimates she saw about 150 police officers flood the area after initial reports of an active shooter.

With files from The Associated Press