A Northern California tow-truck driver who told undercover agents that he wanted to carry out an ISIS-inspired Christmas Day bombing at San Francisco’s popular Pier 39 was sentenced to 15 years in prison.

U.S. District Judge Lawrence J. O’Neill issued the sentence Monday, which came after Everitt Aaron Jameson of Modesto, California, admitted under a plea deal in June that he tried to aid a terrorist organization.

Jameson could have received 40 years in prison.

The 27-year-old planned the attack during talks with undercover FBI agents, including one he thought was with the Islamic State terror group.

Jameson told undercover federal agents that he planned to use pipe bombs to channel victims into part of Pier 39 so he could shoot them. He also offered to provide money to the cause.

In December, through an 11-page affidavit, FBI special agent Christopher McKinney alleged that Jameson espoused “radical jihadi beliefs” on social media, as Fox News previously reported. According to the agent, Jameson “liked” and “loved” ISIS-related social media posts, including one that threatened a Christmas attack in New York City.

McKinney said Jameson attended Marine basic training “in or about” June 2009, and “graduated several months later.” Jameson trained as a sharpshooter, but later was discharged for failing to disclose a history of asthma.

Defense attorney Charles Lee has said his client was having second thoughts, and didn’t take steps to carry out the plot.

Investigators found no bomb-making materials, and three firearms found during a search were owned by his stepfather, and locked away in a place he couldn’t access.

Jameson was arrested Dec. 22.

The Associated Press contributed to this report.