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

Stephen Silva told a judge Tuesday in U.S. District Court that he was "young, dumb, and thought I could outsmart everyone." He had pleaded guilty to gun and drug charges.

Silva testified during the trial of Dzhokhar Tsarnaev that he let Tsarnaev borrow a Ruger 9mm handgun two months before the bombings.

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

Prosecutors sought leniency, saying Silva's cooperation and testimony was critical in convicting Tsarnaev, who was sentenced to death.