SAN BERNARDINO, Calif. - California gunman Syed Rizwan Farook had been in contact with known Islamic extremists on social media, a U.S. intelligence official said Thursday, and police said he and his wife had enough bullets and bombs to slaughter hundreds when they launched their deadly attack on a holiday party.

The details emerged as investigators tried to determine whether the rampage that left 14 people dead was terrorism, a workplace grudge or some combination.

The husband-and-wife killers were not under FBI scrutiny before the massacre, said a second U.S. official, who likewise was not authorized to discuss the investigation and spoke on condition of anonymity.

Wearing black tactical gear and wielding assault rifles, Farook, a 28-year-old county restaurant inspector, and his wife, Tashfeen Malik, 27, sprayed as many as 75 rounds into a room at a social service centre for the disabled, where about 75 of Farook's co-workers had gathered Wednesday morning. Farook had attended the event but slipped out and returned in battle dress.

Four hours later and three kilometres away, the couple died in a furious gunbattle in which they fired 76 rounds, while 23 law officers unleashed about 380, police said.

On Thursday, Police Chief Jarrod Burguan offered a grim inventory that suggested Wednesday's bloodbath could have been far worse.

At the social service centre, the couple left three rigged-together pipe bombs with a remote-control detonating device that apparently malfunctioned, and they had more than 1,600 rounds of ammunition remaining when police killed them in their rented SUV, Burguan said.

At a family home in the nearby town of Redlands, they had 12 pipe bombs, tools for making more, and over 3,000 additional rounds of ammunition, the chief said.

"We don't know if this was workplace rage or something larger or a combination of both," Attorney General Loretta Lynch said in Washington, echoing President Barack Obama. "We don't know the motivation."

Investigators are trying to determine whether Farook, who was Muslim, became radicalized - and, if so, how - as well as whether he was in contact with any foreign terrorist organization, said the U.S. intelligence official, who was not authorized to discuss the matter publicly and spoke on condition of anonymity.

The same official said Farook had been in touch on social media with extremists who were under FBI scrutiny.

The second U.S. official said the FBI was treating the attack as a potential act of terror but had reached no conclusion that it was. The official said Farook had communication with individuals who were under FBI scrutiny. But the contact was with "people who weren't significant players on our radar," dated back some time, and there was no immediate indication of a surge in communication before the shooting.

The official cautioned that such contact by itself doesn't mean someone is a terrorist.

Rita Katz, director of SITE Intelligence Group, an organization that tracks and analyzes extremists, said it hasn't found any connection between Farook and jihadi groups. But she also said that some of Farook's social media posts seem to have been deleted before the attack.

Wednesday's rampage was the nation's deadliest mass shooting since 2012, when 26 children and adults were slain in Newtown, Connecticut.

In San Bernardino, a Southern California city of 214,000, the victims ranged in age from 26 to 60. A further 21 people were injured, including two police officers, authorities said. Two of the wounded remained in critical condition Thursday.

Nearly all the dead and wounded were county employees.

Authorities said the attack was carefully planned.

"There was obviously a mission here. We know that. We do not know why. We don't know if this was the intended target or if there was something that triggered him to do this immediately," David Bowdich, assistant director of the FBI's Los Angeles office, said as the bureau took over the investigation.

Farook has no known criminal record, Burguan said. He was born in Chicago to a Pakistani family, raised in Southern California and worked at San Bernardino County's Department of Public Health for two stints totalling four years since 2010, according to authorities and acquaintances. The Saudi Embassy said he travelled to Saudi Arabia in the summer of 2014 for nine days.

As for Malik, she came to the U.S. in July 2014 on a Pakistani passport and a fiancee visa, authorities said. To get the visa, immigrants submit to an interview and biometric and background checks - screening intended to identify anyone who might pose a threat.

They were married on Aug. 16, 2014, in nearby Riverside County, according to their marriage license. Both listed their religion as Muslim.

The couple had a 6-month-old daughter who they dropped with relatives Wednesday morning before the shooting.

Adam Lankford, a criminal justice professor at the University of Alabama, said his review of mass public shootings in the U.S. indicates this is the first one in recent history involving a male-female team.

Farook was a devout Muslim who prayed every day and recently memorized the Qur'an, according to brothers Nizaam and Rahemaan Ali, who attended Dar Al Uloom Al Islamiyah mosque in San Bernardino with Farook.

Rahemaan Ali said he last saw Farook three weeks ago, when he abruptly stopped going to the mosque. Ali said Farook seemed happy and his usual self, and the brothers never saw a violent side.

"He never ever talked about killing people or discussed politics, or said that he had problems at work," Rahemaan Ali said. "He always had a smile on his face."

Federal authorities said Farook legally bought two handguns used in the massacre and their two assault rifles were legally bought by someone else. Authorities did not say how the rifles got into the attackers' hands.

Farook apparently was no stranger to guns.

A profile on a matchmaking website for South Asians that matched Farook's name, California hometown, county health job and Muslim faith said his interests included target shooting in his backyard. Though the date of the posting was not clear, it listed his age as 22 so it could have been six years old.

Two weeks ago, Farook and one of the co-workers he killed, 52-year-old Nicholas Thalasinos, had a heated conversation about Islam, according to Kuuleme Stephens, a friend of the victim.

Stephens said she happened to call Thalasinos while he was talking with Farook at work. She said Thalasinos told her Farook "doesn't agree that Islam is not a peaceful religion."

As for workplace conflicts, co-worker Patrick Baccari said that until the rampage, Farook showed no signs of unusual behaviour and was a reserved young man.

Baccari said he was sitting at the same table as Farook before Farook suddenly disappeared, leaving his coat on his chair. Baccari was in the bathroom when the shooting started; he suffered minor wounds from shrapnel slicing through the wall.

One of the first officers to reach the room said the carnage was "unspeakable" and the scene overwhelming - the smell of gunpowder, the wails of the injured, the blood, fire sprinklers pumping and fire alarms blaring. All in a room with a Christmas tree and decorations on every table.

"As we entered," said San Bernardino Police Lt. Mike Madden, "the situation was surreal."

-----

Associated Press writers Brian Melley, John Antczak, Christopher Weber, Christine Armario and Gillian Flaccus in Los Angeles; Ken Dilanian, Eric Tucker and Tami Abdollah in Washington; Amy Taxin and Kimberly Pierceall in Redlands; Alina Hartounian in Phoenix; Ellen Knickmeyer in San Francisco; Michael Sisak in Philadelphia; and Holbrook Mohr in Jackson, Mississippi, contributed to this story. Pritchard reported from Los Angeles.