A U.S. prosecutor has cleared an FBI agent of wrongdoing for shooting a friend of the men accused of carrying out the Boston Marathon bombings.

Law enforcement sources said Friday that Florida's state attorney has ruled the FBI agent, who has not been identified, was justified in using force when he shot and killed Ibragim Todashev.

Officials say the agent acted in self-defense after Todashev attacked him during questioning in his Florida apartment last May.

The FBI had gone to Florida to question Todashev, a 27-year-old Chechen immigrant, about his friendship with suspected Boston Marathon bomber Tamerlan Tsarnaev.

Officials say before Todashev attacked the agent, he told investigators that he and Tsarnaev had participated in a 2011 triple murder that was unrelated to the Boston bombings.

Tamerlan Tsarnaev and his brother, Dzhokhar, were accused of carrying out last April's Boston Marathon bombings, which killed three people and injured more than 250 others.

Tamerlan Tsarnaev died following a shootout with police, while Dzhokhar was apprehended and faces the death penalty. He has pleaded not guilty to 30 federal charges.