A former neighbour suspected of supplying guns to the married couple who massacred 14 people in San Bernardino, California, was charged on Thursday with conspiring to provide material support to terrorists, the US Justice Department said.

Enrique Marquez, 24, a friend of Syed Rizwan Farook, 28, who launched the Islamic State-inspired attack on 2 December with his wife, Tashfeen Malik, 29, also told investigators he and Farook plotted earlier mass casualty attacks, prosecutors said.

US Attorney Eileen Decker said the two men conspired to commit "vicious" assaults on targets including a California community college and a state highway during rush hour.

"Even though these plans were not carried out, Mr. Marquez's criminal conduct deeply affected San Bernardino and the entire United States when the guns purchased by Marquez were used to kill 14 innocent people and wound many others," Decker said in a written statement.

Decker said there was no evidence that Marquez took part in 2 December attack or had prior knowledge of it. He was arrested on Thursday, authorities said, and was expected to make an initial appearance in federal court later on Thursday.

According to an affidavit filed by prosecutors, the two men met in 2005 when Marquez became Farook's neighbor in Riverside, California.

Farook introduced Marquez to radical Islamist ideology, prosecutors said, and by 2011 Marquez was spending most of his time at Farook's home listening to lectures and watching videos with extremist content.

At that point, the pair began planning gun and bomb attacks, the affidavit said, and Marquez told investigators their targets included the library or cafeteria at Riverside Community College, where they had both been students.

He and Farook also planned to attack State Route 91 with pipe bombs during afternoon rush hour, and then to shoot at law enforcement and emergency crews as they arrived on the scene, according to the affidavit.

Prosecutors said the pair bought guns, ammunition and tactical gear, and Marquez told investigators he agreed to purchase the weapons because "his appearance was Caucasian, while Farook looked Middle-Eastern."

He bought a Smith and Wesson M&P-15 Sport rifle in November 2011 and a DPMS model A-15 rifle in February 2012, each costing about $750, according to the affidavit.

Marquez also purchased explosives, specifically smokeless powder, as part of the pair's plans "to create bombs and commit mass killings," the affidavit said.

Marquez was also charged with defrauding US immigration authorities by entering into a sham marriage with a Russian woman in Farook's extended family so she could live in the United States, prosecutors said.

Marquez, who had checked himself into a Los Angeles-area psychiatric facility shortly after the shootings, had several connections to Farook and Malik and quickly became a key figure in the investigation of the shootings.

The Federal Bureau of Investigation, which is treating the attack as terrorism, raided his home and questioned him for several days. Sources said Marquez cooperated during their interviews.

Farook, the US-born son of Pakistani immigrants, and Pakistani-born Malik were killed in a shootout with police a few hours after their assault on the party on a holiday party of Farook's co-workers.

Marquez worked at Walmart and at a bar recently. In 2014, state records showed, he married a Russian woman who was the sister of Farook's older brother's wife. Neighbors said they were surprised to learn he had been married, having never seen him with a woman. Prosecutors said on Thursday that Marquez was paid $200 per month for his role in the fraud.

The FBI said Farook and Malik discussed martyrdom online before they even met and were supporters of Islamic State, the violent group that has taken over large parts of Syria and Iraq.

The couple's attack, which left 21 people wounded, has stirred concerns among Americans about national security and the reach of Islamic State, becoming an issue in the US presidential campaign. The attack came a few weeks after gunmen and suicide bombers affiliated with Islamic State killed 130 people in a series of coordinated attacks in Paris.

Neighbors said Marquez and Farook often worked together on cars in Farook's garage in their younger years but that the friendship had cooled in the past three years.

Marquez converted to Islam about the time that Farook became more devoted to the faith around 2008. But Azmi Hasan, manager at the Islamic Society of Corona-Norco, said Marquez later told him that Islam was not for him.

In the middle-class Riverside, California, neighborhood where Marquez lived, people expressed surprise at their neighbor's tie to the attack.

"It's just overwhelming," said Adolfo Agoncillo, 51, as he worked out on Thursday.

President Barack Obama is due to travel to San Bernardino on Friday to meet privately with families of the shooting victims.