RIVERSIDE, Calif. — Enrique Marquez, who supplied the assault rifles used to kill 14 people in a massacre in San Bernardino, Calif., this month, was arrested Thursday and charged with crimes including conspiring to support terrorists. Court papers show that he and one of the attackers had steeped themselves for years in radical and violent Islamist propaganda, including the teachings of the extremist cleric Anwar al-Awlaki and bomb-making techniques from an Al Qaeda magazine.

Mr. Marquez, 24, has told investigators that he and an attacker, his longtime friend and neighbor, Syed Rizwan Farook, had been discussing radical Islam since 2007. They made plans in 2011 and 2012 to launch deadly attacks on the college they had attended and on a busy California freeway.

Mr. Marquez bought not only the guns used in the San Bernardino shooting but also the smokeless powder that Mr. Farook used to build pipe bombs, according to documents filed in Federal District Court here on Thursday.

In addition to the terrorism charge, he faces a count of lying on gun purchase forms to conceal that he was really buying them for Mr. Farook, and one of defrauding the immigration system by entering into a sham marriage with a Russian immigrant.

The court papers filed on Thursday offered the first picture of how Mr. Farook, an American-born Muslim whose parents are from Pakistan, became radicalized — long before the rise of the Islamic State — and who his influences were.

The documents offer previously unreported details about his actions and attitudes, including his disdain for American Muslims who went into the military and killed other Muslims, along with the specifics of the attacks he and Mr. Marquez had plotted and the weaponry they amassed. They paint a vivid picture of Mr. Farook’s efforts to radicalize Mr. Marquez, urging him to listen to speeches by a Qaeda leader and read a magazine published by a Qaeda affiliate that provided bomb-building instructions.

In 2012, Mr. Marquez got cold feet, spooked by the arrests of some local men for plotting jihad. Two years later, Mr. Farook met his wife, Tashfeen Malik, a Pakistani whom he brought to the United States and with whom he carried out the attack.

On Dec. 2, Mr. Farook and Ms. Malik stormed a meeting of Mr. Farook’s co-workers at the San Bernardino County health department, killing 14 people and injuring 22 others. They died later that day in a gun battle with the police, who homed in on the rented sport utility vehicle they were driving after they failed to yield.

The couple appears to have had no direct contact with any terrorist groups, once again raising the specter of domestic extremists who, inspired by those groups, become radicalized on their own without attracting the attention of law enforcement.

The criminal complaint says that when the shootings took place, Mr. Marquez was at work as a security guard at a Walmart. He also sometimes worked at a bar, doing odd jobs.

Mr. Marquez appeared in court Thursday afternoon wearing a beige T-shirt, black pants, handcuffs, shackles and a chain around his waist. A judge read him the charges, and he was told to return on Monday for a bail hearing. An arraignment was scheduled for Jan. 6, when he is expected to enter a plea.

The information in the complaint came largely from Mr. Marquez. Law enforcement officials say that Mr. Marquez spent 11 days telling them what he knew, each day signing a waiver of his right to remain silent and his right to have a lawyer there. Investigators said that a clearly distraught Mr. Marquez almost immediately confessed his connection to the crimes to a 911 operator and to his mother, and spent a few days in a hospital psychiatric ward before talking with the F.B.I.

The authorities said that weeks before the massacre, Mr. Marquez wrote on Facebook that “my life turned ridiculous.” When a friend responded, “I think everyone leads multiple lives,” Mr. Marquez replied, “Involved in terrorist plots, drugs, antisocial behavior, marriage, might go to prison for fraud, etc.”

Early on the day after the shooting, he called 911 and said, “My neighbor. He did the San Bernardino shooting.” Later during that call, he said that Mr. Farook “used my gun in the shooting,” and “they can trace all the guns back to me.”