Associated Press

BOSTON — A man who loaned a gun used by the Boston Marathon bombers to kill a police officer was sentenced Tuesday to the 17 months he has already served and apologized, saying his actions were "dumb."

"I was young, dumb, and thought I could outsmart everyone," 22-year-old Stephen Silva told a judge in U.S. District Court. He pleaded guilty to gun and heroin distribution charges last year.

Related articles Video: Footage of Boston bombers ambushing officer released

Silva testified during the trial of Dzhokhar Tsarnaev that he let Tsarnaev borrow a Ruger 9mm handgun two months before the bombings. The two had known each other since eighth grade and attended school together in Cambridge.

He said Tsarnaev told him he wanted the gun to rob University of Rhode Island students, adding that Tsarnaev "kept coming up with excuses" for not returning it.

He said he didn't know about the bombers' plan and had no idea the gun would be used to kill an officer.

Prosecutors said the gun was used by Tsarnaev and his brother, Tamerlan, to kill Massachusetts Institute of Technology Officer Sean Collier days after the April 2013 bombings that killed three people and injured more than 260.

Prosecutors sought leniency, asking for a two-year sentence and saying Silva's cooperation and testimony was critical in convicting Tsarnaev. He was sentenced to death in June; brother Tamerlan was killed in a gunfight with police hours after Collier's death.

"The marathon bombing trial team has advised that Silva was an important and credible witness at trial. In particular, his testimony cut against the defense argument that Dzhokhar's older brother, Tamerlan Tsarnaev, was the driving force behind the entire operation and that Dzhokhar was essentially under his sway," prosecutors wrote.

Silva's brother broke out in applause when the sentence was announced and was escorted from the courtroom.

Copyright 2015 The Associated Press