The man shot and killed Tuesday by Boston police was plotting with another suspect to behead a cop, a law enforcement source told FoxNews.com

The dead suspect, 26-year-old Usaama Rahim, was under surveillance by the Joint Terrorism Task Force, which is comprised of state, local and federal law enforcement agents, when he was shot at about 7 a.m. near a CVS in the city's Roslindale neighborhood, when he brandished the blade at police. Later Tuesday, authorities arrested another suspect, David Wright, in connection with the case, police said.

"We believe the intent was to behead a police officer," one official told The Boston Globe. "We knew the plot had to be stopped. They were planning to take action Tuesday."

Rahim, Wright and an unidentified third person met Sunday on a Rhode Island beach to discus plans, the affidavit, which was released Wednesday, said. Wright, who waived his Miranda rights, told the FBI the plans included an attack on a victim in another state, the court papers said. Hours prior to the shooting, Rahim told Wright he had changed plans and was going to "go after" the "boys in blue," the court papers said. 

"I'm going on vacation right here in Massachusetts. I'm just going to, ah, go after them, those boys in blue," Rahim said in the phone conversation, according to the affidavit. Authorities believe the word "vacation" stood for violent jihad in their conversations. Wright encouraged him to delete any information on his cell phone or computers, the affidavit said. Wright is accused of conspiring with Rahim to impede the investigation and faces up to five yes in prison if convicted.

More On This...

The affidavit said one of the officers outside the CVS instructed Rahim to drop his weapon and Rahim responded, "You drop yours." 

Boston Police Commissioner William Evans told reporters that Rahim was approached by the officers who wanted to question him on "terrorist-related information" when he moved toward officers with the knife. He purchased an Ontario Spec Plus Marine Raider Bowie fighting knife with a 9.75 inch blade a few days earlier on Amazon.com, an affidavit said. 

Evans said the officers didn't have their guns drawn when they approached Rahim. He said police have video showing Rahim "coming at officers" while they are backing away. That account differs from one given by Rahim's brother Ibrahim Rahim, who said in a Facebook posting that his youngest brother was killed while waiting at a bus stop to go to his job.

"He was confronted by three Boston Police officers and subsequently shot in the back three times," he wrote. "He was on his cellphone with my dear father during the confrontation needing a witness."

Surveillance video from the scene was shown to some civil rights advocates. 

The president of the Urban League of Eastern Massachusetts says a video shows a terror suspect killed in Boston was not shot in the back, as his brother had claimed. Darnell Williams told reporters after viewing the police video that Rahim "was not on a cellphone and was not shot in the back."

"We believe the intent was to behead a police officer. "We knew the plot had to be stopped. They were planning to take action Tuesday."

- Official

But one Boston Muslim leader called the video "inconclusive." Imam Abdullah Farooq says it showed Rahim wasn't shot in the back, but the quality was poor and it wasn't clear whether police had to use deadly force.

Evans said officers repeatedly ordered Rahim to drop the knife but he continued to advance. He said task force members fired their guns, hitting Rahim once in the torso and once in the abdomen. Rahim was taken to Brigham and Women's Hospital, where he was pronounced dead.

Later, the FBI and local police arrested a man at a home in Everett, Mass., in an action authorities said was related to the Roslindale shooting. Christina Diorio-Sterling, a spokeswoman for U.S. Attorney Carmen Ortiz, said Wright was taken into custody from his home in suburban Everett. She said Wright will face federal charges and is expected to appear in U.S. District Court on Wednesday.

WFXT reported that three different Joint Terrorism Task Force teams had been carrying out 24-hour surveillance on at least three different people in the Boston area, though it was unclear how long that had been going on.The plot may have been inspired by the terror group ISIS, who have repeatedly called on followers in the United States to attack law enforcement officials or military installations.

Evans did not comment on the report that Rahim had been radicalized by ISIS, but said, "Obviously, there was enough information there where we thought it was appropriate to question him about his doings ... He was someone we were watching for quite a time."

The officer and the agent involved in the shooting weren't physically injured but were evaluated at a hospital for what Evans described as "stress."

WFXT reported that Rahim worked in loss prevention at several CVS stores in the Boston area. Wright confirmed in an interview that Rahim planned a violent attack in the U.S., according to his affidavit. 

However, it was not clear that the store where he was killed was among them. Boston voter registration records seen by the Associated Press list Rahim as a student. Other records indicate that as recently as two years ago he was licensed as a security officer in Miami, but don't specify in what capacity.

The Islamic Society of Boston Cultural Center said its security firm hired Rahim as a security guard for a month in mid-2013. Executive director Yusufi Vali said Rahim didn't regularly pray at the center and didn't volunteer there or serve in any leadership positions.

The FBI and Rhode Island State Police also searched a property in Warwick, R.I. in relation to the Roslindale shooting. Police sealed off a street and later cleared the scene. There were no arrests.

A 17-year-old told the Boston Globe that police had asked him about a neighbor in his mid-20s named Nick. The teen told the paper Nick often wears long robes and prays in his front yard.

The Associated Press contributed to this report