The FBI and Boston police shot and killed a knife-wielding Roslindale man known for extremist views and arrested another person at an Everett home yesterday as part of an anti-terrorism task force investigation into threats to behead law enforcement officials, the Herald has learned.

The two-state probe by the Joint Terrorism Task Force included a raid of an Everett triple-decker and an investigation in a Warwick, R.I., neighborhood, all within hours after police say 26-year-old Usaamah Rahim came at cops and an FBI agent with a military-style knife and was shot twice in a Roslindale CVS parking lot around 7 a.m.

Rahim, who the task force had under 24-hour surveillance for weeks, was later pronounced dead at Brigham and Women’s Hospital. FBI Special Agent in Charge Vincent B. Lisi would only say task force members wanted to “interview him and talk to him about his intentions.”

A source with knowledge of the investigation told the Herald the probe was sparked by threats calling to cut the heads off law enforcement officials.

Police Commissioner William B. Evans said authorities knew Rahim “had some extremism as far as his views,” but stopped short of confirming that it was connected to a stream of chilling online calls from ISIS urging its followers around the world to attack law enforcement and military officials.

ALSO READ:

In Everett, authorities descended upon a triple-decker on Linden Street where a man was led away by FBI agents at around 5:30 p.m.

Boston police last night said they were charging a man arrested in Everett who was connected to the probe with conspiracy to commit murder. But the case may be moved to federal court, a law enforcement source said.

The Roslindale shooting was captured by surveillance video, which Evans said shows Rahim “coming at the officers” as police retreated, telling him to “Drop the knife!” They then shot him twice, once in the torso and abdomen, he said.

“We believed he was a threat,” Evans said. “He was someone we were watching for quite a time. The level of alarm brought us to question him.”

Police plan to show the video to community leaders this morning and could release it to the public afterward.

“It’s our job as community activists to review and expect that information to see whether or not everything was above board and on point,” said Darnell Williams, president of the Urban League of Eastern Massachusetts and one of those invited to screen the surveillance footage.

The showdown in the Roslindale parking lot erupted at the beginning of the morning commute.

A Roslindale mother and her 10-year-old son heard the gunfire and saw the aftermath of the police shooting from a second-story window across the street, the mother said.

Luz Garces, 47, said she was in her kitchen when she heard a “couple” of gunshots, describing two or three rounds, followed by her young son entering the kitchen telling her, “Mommy, Mommy, there was a shooting at the CVS.”

Imam Ibrahim Rahim, who identified himself as Usaamah Rahim’s brother, said in a Facebook post his younger brother was waiting at a bus stop “to go to his job” when he was approached by police officers. He wrote that his brother was shot three times in the back, and was on the phone with his father “during the confrontation.”

He said his brother’s last words were, “I can’t breathe.”

Those were the same words Eric Garner of Staten Island, N.Y., said last year before he died from a chokehold put on him by police.

Ibrahim Hooper, a spokesman for the Council on American-Islamic Relations, said officials spoke with Ibrahim Rahim, who confirmed it was his brother who was killed. “We’re monitoring the situation to see how it develops,” Hooper told the Herald. “My first question is, what was the probable cause for the stop?”

Jake Wark, a spokesman for Suffolk District Attorney Daniel F. Conley, said the DA has asked the state medical examiner’s office to expedite Rahim’s autopsy because his family requested that the body be turned over to them so he can be buried within 24 hours of his death as part of their religious beliefs.

The triple-decker in Everett is well known in the neighborhood as a drug hot spot nicknamed the “Candy Shop,” according to Jim McCabe, 30. A man in a pickup truck drove by later and yelled, “It looks like the Candy Shop is closed!”

The anti-terrorist probe also reached down to Warwick, R.I., where state police blocked Aspinet Drive and refused to let anyone down the street where neighbors said a home was being searched. It was unclear what authorities were looking for but a law enforcement official familiar with the probe said it was connected to the task force’s investigation.

Ralph Thomas, 77, of Warwick has a backyard that partially abuts the home, but he said he had no idea what was going on.

“We don’t really know anybody in back of us,” he said. “You just don’t go back there.”

Antonio Planas, O’Ryan Johnson and Laurel J. Sweet contributed to this report.