A man was shot and killed during a confrontation with law enforcement in Boston this week. It was revealed that he was involved in a plot to behead police officers. Agents had been monitoring 26-year-old Usaama Rahim as part of a terrorism probe when they say they overheard him talking about beheading an officer. Rahim was shot dead after allegedly lunging at two officers with a knife.

A relative of Rahim’s identified as David Wright was arrested and charged with conspiracy. Officials say Rahim became radicalized by online jihadist sites and was inspired by the Islamic State. Briefing reporters, Boston Police Commissioner William Evans said he had been under 24-hour surveillance.

Boston Police Commissioner William Evans released the following statement: “This guy required 24/7 surveillance, so we thought the threat was severe enough that we had to approach him. We never expected what happened, but, you know, hopefully it will all come out later so there’s a better understanding of the level of threat. But I can’t go into anything more than, you know, it was a very serious threat, and that’s why we didn’t take it lightly.”

The shooting occurred in the fairly quiet neighborhood of Roslindale on Tuesday morning, when officials said an F.B.I. agent and a Boston police officer fired on Mr. Rahim after he threatened them with a knife. The shooting quickly and suddenly revealed what officials described as a lengthy terrorism investigation, with several law enforcement agencies looking into a suspected murder plot that involved at least two other people, including David Wright, who was charged Wednesday with conspiracy.

Mr. Rahim was a religious mentor to his nephew David Wright. At first, the two followed the strict teachings of the Muslim Brotherhood but then they started doing their own thing after deciding other conservative sects were “too lenient.”

Investigators described in detail, recent phone conversation between the two describing a planned attack on the “boys in blue”. Neighbors said they saw a SWAT team and about 20 or 30 officers enter through the open front door of the small apartment building where Mr. Wright lived with a woman and two children.

According to the F.B.I., he waived his right to remain silent and agreed to speak to agents. Mr. Wright faces a federal conspiracy charge. A criminal complaint charges that he conspired with Mr. Rahim to hinder a federal investigation by destroying electronic evidence. Mr. Wright faces up to five years in prison, three years of supervised release and a fine of up to $250,000. He was remanded to the custody of the federal marshal service until a detention hearing June 19.

The F.B.I. said a third person in Rhode Island, who was not identified, was also involved in the plot. Agents searched a house in Warwick, R.I., on Wednesday, but have not announced any more arrests. The shooting and arrests once again raise alarms about the influence of foreign extremists on homegrown radicals.