San Berardino guns
Four guns are seen on Dec. 4, 2015, near the site of a shootout between police and suspects at a social services center in San Bernardino, California. Enrique Marquez, a friend and former neighbor of one of the suspects, is accused of buying the rifles used in the shooting at Inland Regional Center, where 14 people were killed and 22 were injured on Dec. 2 San Bernardino County Sherrif's Department via Getty Images

Enrique Marquez, the man accused of purchasing the rifles used in the Dec. 2 massacre in San Bernardino, California, was denied bail in federal court Monday in Riverside, California, about 10 miles from the scene of the attack. The judge ordered Marquez to be held until a Jan. 4 hearing, calling him a flight risk, the Los Angeles Times reported.

Marquez, 24, was charged last week with conspiring with San Bernardino shooter Syed Farook in 2011 and 2012 to commit crimes of terrorism, as well as unlawfully purchasing two assault rifles. Marquez, a former neighbor and longtime friend of Farook, was also charged with visa fraud stemming from his marriage to a woman whose sister is married to Farook's older brother, which prosecutors say was a sham. If convicted of all charges, he could face up to 35 years in prison, the Associated Press reported.

Investigators say Marquez and Farook were planning attacks on the school they attended, Riverside Community College, and on a crowded California freeway in late 2011. Marquez bought two assault rifles from a sporting goods store at the time. The two never carried out an attack together, but authorities say the guns purchased by Marquez years ago were used by Farook and his wife, Tashfeen Malik, to kill 14 people inside a social services center earlier this month. Farook and Malik also wounded 22 others before they were shot dead in a gunbattle with police after they fled in an SUV. There is no evidence that Marquez collaborated with the couple in the deadly shooting.

Enrique Marquez
Enrique Marquez, 24, is shown in this courtroom sketch as he appears with legal representatives during a hearing in federal court in Riverside, California, Dec. 17, 2015. Reuters/Bill Robles

A day after the San Bernardino massacre, Marquez called 911 and contemplated suicide, according to a transcript included in the affidavit.

“What’s wrong? Why do you feel like you want to kill yourself? What’s going on?” the dispatcher asked.

“I don't know. My neighbor. He did the San Bernardino shooting,” Marquez said. “They can trace all the guns back to me.”

He checked himself into a mental hospital shortly after the phone call.

Marquez moved in 2004 to Riverside, where he met Farook, his neighbor at the time. Farook introduced him to Islam and Marquez eventually converted to the religion in 2007. He began attending prayers at the Islamic Society of Corona-Norco, Yousuf Bhaghani, president of the facility's board of directors, told the L.A. Times. Marquez's conversations with Farook about Islam took a radical turn thereafter, as Farook introduced him to extremist ideologies, according to the affidavit.