SACRAMENTO, Calif. — A man who told undercover agents that he wanted to carry out a Christmas Day bombing and shooting attack at a popular San Francisco tourist attraction will receive a 15-year sentence after pleading guilty Monday in a federal case.

Everitt Aaron Jameson, 26, admitted under a plea deal that he attempted to aid a terrorist organization after he planned the attack during talks with undercover FBI agents, including one he thought was with the Islamic State group.

Jameson, a former tow-truck driver from Modesto, told undercover federal agents that he planned to use pipe bombs to channel victims into part of Pier 39 so he could shoot them.

Prosecutors are dropping a second charge of distributing bomb-making information under the plea agreement.

He told the undercover agents how to build pipe bombs and where he intended to assemble the bombs, and he asked them for remote timers, according to court documents.

Each charge carries a maximum penalty of 20 years in prison, and Jameson didn't want to take the chance of receiving a 40-year sentence, defense attorney Charles Lee said.

Lee said his client was having second thoughts and didn't actually take steps to carry out the plot. Investigators found no bomb-making materials, and three firearms found during a search were legally owned by his stepfather and were locked in a gun case where Jameson couldn't to get them, Lee said.

An undercover agent told Jameson several times to think about what he was doing, according to the FBI, and each time Jameson said he was ready to attack. Agents also recovered a martyr's letter signed with an Islamic variation of Jameson's name.

Jameson was discharged from the Marines for having an allergic reaction to a bee sting, had a "tumultuous marriage" in which his wife went to prison for attacking him with a knife, and he lost parental rights to his two children two days before he first talked to agents, Lee said.

"Every time the government's been involved in his life, it's turned out poorly for him," Lee said. "I do believe he was very susceptible to suggestion."

The FBI arrested Jameson on Dec. 22. He is set for sentencing Sept. 4.