(If you’re having trouble viewing this video on a mobile device, click here.)

SAN FRANCISCO — A Modesto man who is a Marine-trained sharpshooter is accused of helming a Christmas Day plot to detonate explosives and unleash a hail of bullets at Pier 39 — a scheme that was thwarted by undercover FBI agents who feigned sympathy to his ISIS leanings.

Everitt Aaron Jameson, 26, was arrested Friday and charged in the U.S. District Court for the Eastern District of California with attempting to provide material support to a foreign terrorist organization. He was arraigned in Fresno, but did not enter a plea.

“Today, our incredible law enforcement officers have once again helped thwart an alleged plot to kill Americans,” U.S. Attorney General Jeff Sessions said in a statement. “The threat from radical Islamic terrorism is real — and it is serious — but the American people can be assured that the Department of Justice remains vigilant in protecting our homeland.”

But for civil-liberties groups, especially those that advocate for Muslim rights, the arrest marked another troubling instance of ensnaring people who would not pose a threat without the government’s encouragement.

“While I am relieved that an alleged terrorist plot was thwarted, I worry that law enforcement may be continuing to use national security as a guise for turning aspirational terrorists into operational ones,” said Zahra Billoo, executive director for the San Francisco Bay Area chapter of the Council on American-Islamic Relations. “This is frightening from both a safety and liberty perspective.”

According to a criminal complaint, Jameson was identified as an ISIS supporter in September based on his social-media activity, which was brought to authorities’ attention by an agency informant. From that point, FBI agents posing as terrorist sympathizers began routinely communicating with Jameson to draw out his possible intentions for mass violence.

Jameson offered his wages, his vehicle access as a tow truck driver, and his military experience — he trained as a sharpshooter with the U.S. Marine Corps but was discharged shortly after completing basic training for not disclosing an asthma condition — as resources for an attack in San Francisco, the FBI asserts.

While in communication with the undercover agents, Jameson reportedly expressed admiration for the 2015 San Bernardino mass shooting, and the Oct. 31 terror attack in New York City in which a driver drove a box truck through a busy pedestrian and bicycle pathway in Lower Manhattan, killing eight people.

Jameson’s alleged plan for the San Francisco attack was to set off pipe bombs at the pier to “funnel” fleeing people into an area where he would be waiting to shoot them with an assault rifle, the complaint states. He reportedly described Christmas as “the perfect day” for an attack and also expressed willingness to sacrifice his life for the cause.

“Jameson said he did not have and did not need an escape plan because he was ready to die,” the criminal complaint reads.

The FBI contends that when Jameson met with undercover agents Dec. 16, it was his belief that he was making contact with high-level ISIS leadership. At the meeting, he is said to have requested “ammunition, powder, tubing and nails,” and suggested he would assemble pipe bombs at a remote campground.

Two days before he was arrested, Jameson apparently tried to back out of the plan.

“I don’t think I can do this after all. I’ve reconsidered,” Jameson said, according to the criminal complaint.

It was too late: On Wednesday, FBI agents descended on Jameson’s home in Modesto and served a search warrant that reportedly turned up two handguns, a small-caliber rifle, assorted fireworks, and a last will and testament notarized a month ago.

Start your day with the news you need from the Bay Area and beyond.

Sign up for our new Morning Report newsletter.

In a handwritten letter found at his home that seemingly forecasted the attack, he signed with the name Abdallah abu Everitt ibn Gordon al-Amriki, according to the FBI.

The FBI in its affidavit also admitted that the agency almost ruined its own operation after an employee mistakenly called the suspect from a 202 area code — Washington, D.C. — then quickly hung up as soon as the error was realized. Fortunately for the employee, when Everitt Jameson called back and was sent to the number’s voicemail, the greeting message did not specify any affiliation with the bureau.

The suspect’s father, Gordon Jameson, described the news about his son as “unreal.”

“I didn’t really understand it,” he told ABC30 in Fresno. “It kills me he might do something like that.”

Gordon Jameson, who last saw his son when they attended the Raiders-Cowboys game in Oakland last weekend, said the younger Jameson converted to Islam in the wake of a divorce and the loss of custody of his two young children.

“That crushed him,” Gordon Jameson said.

Gordon Jameson added that he debated with his son over his new religion — Everitt Jameson was raised as a Christian — but that he saw nothing that would suggest it spurred the acts for which he is now incarcerated.

“‘We do nothing but peace, we’re peace and love,'” he recalled his son telling him.

In a similar 2013 case, San Jose resident Matthew Aaron Llaneza, was made to believe he was working with the Taliban in a plot to bomb a Bank of America branch in Oakland. He eventually reached a plea agreement with the government and was given a 15-year federal prison sentence.

Billoo sees parallels in the case that surfaced Friday, and felt similar skepticism.

“I worry that busts like this are part of a larger ineffective War on Terror framework,” she said. “I don’t feel any safer from terrorism or hate today than I did 15 years ago. Any sense of safety I have comes from friends and allies, not the FBI.”

Staff writer Emily DeRuy contributed to this report.