A Massachusetts man fatally shot Tuesday by police was allegedly plotting with another man taken into custody to behead a police officer.

Law enforcement officials shot and killed 26-year-old Usaama Rahim Tuesday morning after an FBI agent and police officer approached the suspect near a CVS store in Boston. Rahim pulled out a black, military-style knife with an 8-inch blade, the Boston Globe reports. After ordering the suspect to drop the weapon, officers opened fire, killing Rahim.

A second suspect, David Wright, was taken into custody later that night. The Boston Joint Terrorism Task Force had been closely monitoring both men for several weeks. On Wednesday, officials said Wright and Rahim had been plotting to behead an officer and were on the cusp of carrying out the attack.

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

Rahim's older brother, Ibrahim, is a well-known imam in his community. In a Facebook post announcing his brother's death, Ibrahim Rahim said the officers shot him three times in the back while his brother was on the phone with their father. Police have said that Usaama Rahim lunged at them with the knife and officers were forced to kill him.

Your prayers are requested:This morning while at the bus stop in Boston, my youngest brother Usaama Rahim was waiting...

"We believed [Rahim] was a threat," Boston Police Commissioner William B. Evans told the Globe. "He was someone we were watching for quite a time. The level of alarm brought us to question him today. I don't think anybody expected the reaction we got out of him."