The man who carried out the worst terrorist attack on American soil since 9/11 — the San Bernardino shootings — had planned, with a longtime friend, to massacre students at a California college and gun down commuters on a California highway, as early as 2011, the FBI said on Thursday.

See also: Friend of San Bernardino attacker charged with terrorism counts

Syed Rizwan Farook, who was killed in a shootout with police, planned the attacks with his friend, Enrique Marquez, who the FBI has now charged with terrorism counts related to the abandoned plots.

Marquez, 24, has been speaking with federal investigators since the Dec. 2 attack, and he explained in detail the plots that, for one reason or another, never came to fruition.

A Facebook photo dated October 2, 2015 shows 24-year-old Enrique Marquez (left,) who owned two of the guns used in the San Bernardino mass shooting committed by Syed Rizwan Farook (seen in his DMV photo, right) and his wife Tashfeen Malik.

“Mr. Marquez conspired with Mr. Farook to commit vicious attacks, as set forth in today’s charges,” said U.S. Attorney Eileen M. Decker of the Central District of California in an FBI release.

“Even though these plans were not carried out, Mr. Marquez’s criminal conduct deeply affected San Bernardino County, Southern California, and the entire United States when the guns purchased by Marquez were used to kill 14 innocent people and wound many others."

Riverside Community College

The two friends began discussing their terror plots sometime in 2011, the complaint says, years after Farook convinced Marquez to convert to Islam, and were designed to "maximize casualties."

Image: Google

The first of the two plots, which were discussed while the men consumed recordings from radical Islamic preachers, or read copies of the al-Qaeda magazine Inspire, reportedly targeted either the library or the cafeteria at Riverside Community College, where both Farook and Marquez had been students.

The plan, as Marquez explained to investigators, was to throw pipe bombs into crowds of students in one of the two locations from a second-floor overlook, and then gun them down as they fled the blasts. The two hopeful terrorists had planned to escape undetected and carry out further attacks elsewhere.

Marquez went so far as to draw a map for investigators, showing just how they planned to commit the attack, they said.

State Route 91

Marquez and Farook also planned a "rush-hour attack" on State Route 91 (SR-91), a highway that services the Los Angeles area, the FBI says in the complaint, targeting a particular eastbound stretch of road that had no exits — again to maximize casualties.

Image: Wikimedia Commons

Two two again planned to throw pipe bombs from above — this time on commuters from the top of a hill — which would "disable and stop traffic." That, Marquez allegedly said, would put the men in position to commit mass murder.

"Farook planned to move along the stopped vehicles, shooting his rifle into them, and killing people," the complaint says. Marquez, meanwhile, was to stay in the hills and fire upon law enforcement officials and emergency workers as they arrived at the scene to treat the wounded.

Marquez said he went so far in 2012 as to acquire the firearms that would be used in the highway attack, purchasing AR-15s from local sporting goods stores.

He also allegedly bought a "smokeless powder" to be used in the construction of explosive devices — the same type of powder that was found in a pipe bomb left at the scene of the 2015 attack in San Bernardino.

That task fell to Marquez, he told investigators, because he was white. Farook was Middle Eastern, and the two assumed that would raise suspicions.

Ultimately, Marquez "distanced himself from Farook" and stopped planning attacks, "for a variety of reasons," the FBI says.

One of those reasons, they claimed, was the November 2012 arrest of Ralph Deleon, a legal resident in the U.S., who was charged with attempting to travel abroad to fight alongside the Taliban and al-Qaeda.

All in all, the charges carry a combined 35 years in prison.