A Massachusetts man shot dead by police had discussed plans to behead police officers with an associate arrested the same day, according to papers filed in a Boston court.

Reuters said that Usaamah Abdullah Rahim, 26, who was shot and killed after allegedly confronting officers with a large knife, had told David Wright: “I’m just going to, ah, go after them, those boys in blue.”

Mr Rahim had ordered three knives, with blades ranging in length from eight to ten inches, from online retailers and had joked in wire-tapped phone conversations with Mr Wright, 24, about “thinking with your head on your chest”, according to an affidavit by FBI officers.

Usaamah Rahim was killed by police and FBI officers after allegedly confronting them with a knife

Federal Bureau of Investigation Special Agent Joseph Galietta described that as “a reference to the practice of some foreign terrorist organisations to behead targets and place their heads on their chests in propaganda videos”.

Isis has released multiple videos depicting the apparent beheadings of captives, including several foreign journalists.

Mr Wright, who was arrested late Tuesday in the Boston suburb of Everett, advised Mr Rahim to destroy his computer and smartphone to ensure there was no record of the plot, the affidavit said.

“I would urge the government, the FBI and law enforcement in investigating this case and related cases to be as transparent as possible and, in enforcing the law, to abide by the law,” Mr Wright’s lawyer, Jessica Hedges, said after his court appearance.