The Federal Bureau of Investigation (FBI) has arrested a former US marine who was planning to attack a tourist pier in San Francisco on Christmas Day in the name of the Islamic State (IS).

Everitt Aaron Jameson, 26, became a suspect of US authorities in September because of his postings on social medial in support of jihadis, according to court documents entered on Friday by the FBI.

Jameson had celebrated on Facebook the attack that left eight people dead on October 31 in Manhattan, perpetrated by a man who also said he was acting on behalf of the IS, reports Efe news.

It was a trusted FBI informer who tipped off the agency about Jameson’s cyber plotting.

Earlier this month, an undercover FBI agent posing as an IS member got in touch with Jameson.

The man now in custody offered to do “whatever” in the name of the IS and particularly noted how his military experience in the “army of the infidels” equipped him to perpetrate the attack.

According to the FBI, Jameson spoke in that way about his time in the US Marine Corps in 2009, when he was discharged for “fraudulent enlistment” because he never mentioned his chronic asthma.

During his time in basic training with the marines, Jameson earned a “sharpshooter” qualification.

Asked by the undercover agent about some specific plan, Jameson spoke of attacking the Pier 39 in San Francisco on Christmas Day.

Jameson, who had conceived a combined bombs and firearms attack, asked the undercover agent for a rifle and explosive material, and told him he was “ready to die”.

His plan was to make the bombs at a distant campsite, then store them in his house in Modesto, California.

In a statement from the Department of Justice, Attorney General Jeff Sessions said that “today, our incredible law enforcement officers have once again helped thwart an alleged plot to kill Americans”.