Enrique Marquez, the man who purchased the guns used in the San Bernardino, Calif., mass shooting this month, is facing criminal charges, the Department of Justice has announced.

Marquez has been charged with conspiring to commit acts of terrorism — for aborted plans authorities say he hatched with Syed Farook, the San Bernardino shooter, in 2011 and 2012 — as well as with unlawfully purchasing the firearms used in the San Bernardino attack.

Marquez was a friend and former neighbor of Farook, authorities say. Farook and his wife, Tashfeen Malik, killed 14 people at a holiday party thrown by Farook's employer; they were killed in a shoot-out with police. Authorities say Farook and Malik had been radicalized for several years, and their attack is being investigated as an act of terrorism.

The Justice Department says Marquez and Farook met about a decade ago, and that Marquez converted to Islam in 2007. The two men read, watched and listened to "radical Islamic materials" together, authorities say.

Then, in 2011, the two men began plotting a terrorist attack that never came to fruition — but along the way, Marquez purchased the assault-style rifles Farook and Malik used, the Justice Department says.

Authorities are charging Marquez with buying those guns on behalf of Farook — a violation of the law, but one that's often hard to prove in court, as NPR's Hansi Lo Wang reported last week:

"Buying guns from licensed dealers for someone else is illegal. 'Straw purchasers' break the law by fraudulently filling out a form that says they're the actual buyer, [when] they're actually buying the gun for another person — someone who might be avoiding a background check."Proving that scenario in court can be a challenge." 'You have to get into the mind of the person who's buying the gun and filling out the form,' says Michael Bouchard, a retired assistant director for the Bureau of Alcohol, Tobacco, Firearms and Explosives. 'The tough part about this is, and the reason straw purchasers rarely get prosecuted is, because it's in the eyes of the beholder.' "

The Justice Department says Marquez told investigators he made the purchase because he looked white, while Farook looked Middle Eastern.

(Even if Marquez had initially bought the guns for himself, he wouldn't be off the hook: In California, a private transfer of guns is supposed to go through a licensed dealer.)

Marquez also purchased explosives, the Justice Department says.

The Justice Department says Marquez had "distanced himself" from Farook after 2012, when their plans fell apart, and was no longer plotting terrorist attacks with him. There's no evidence he had advance knowledge of the San Bernardino attack, authorities say.

Marquez is also charged with immigration fraud, for what the Justice Department calls a "sham marriage" with a member of Farook's extended family.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.