BOSTON — Boston Marathon bomber Dzhokhar Tsarnaev borrowed a gun two months before the 2013 attack and “kept coming up with excuses” for not returning it, a close friend testified Tuesday.

Prosecutors have identified the Ruger handgun as the gun used by Tsarnaev and his brother to kill a Massachusetts Institute of Technology police officer as they attempted to flee the area three days after the bombings.

Stephen (STEF’-ihn) Silva testified that several weeks after he first showed Tsarnaev the gun, Tsarnaev asked if he could “potentially borrow” it.

“He said he wanted to rip (rob) some kids from URI,” Silva said, apparently a reference to the University of Rhode Island.

Silva said that after a few weeks, he asked Tsarnaev for the gun back, but Tsarnaev repeatedly made up excuses for why he didn’t return the gun.

The bombing killed three people and injured more than 260 others. Testimony in the case began March 4. Tsarnaev, 21, faces the possibility of the death penalty if convicted.

Dzhokhar #Tsarnaev with high school weed bud Stephen Silva, who testified for the govt today. Silva = gun connection pic.twitter.com/wU0KDT1MdZ — Ann O’Neill (@AnnoCNN) March 17, 2015

Silva, who was charged last year with possession of a gun with an obliterated serial number and drug charges, said Tuesday he was testifying against Tsarnaev as part of a plea agreement with prosecutors. He acknowledged that he is hoping prosecutors will recommend a sentence below five years.

Silva appeared uncomfortable, sighing at times as he testified against the man he described as a close friend he had known since the eighth grade. Tsarnaev, seated at a table with his attorneys about 12 feet away from Silva, gave him several long looks during his testimony.

During opening statements in the trial, Tsarnaev’s lawyer admitted that he participated in the bombings, but said his older brother, Tamerlan, was the mastermind and recruited him to help. His lawyer said it was Tamerlan who used the gun to shoot MIT police Officer Sean Collier.

But prosecutors, through Silva’s testimony, established that Tsarnaev is the one who obtained the gun used in Collier’s killing.

During cross-examination, Tsarnaev’s lawyer suggested again that Tamerlan was a domineering older brother and had a powerful influence over Dzhokhar. Attorney Miriam Conrad asked Silva if he knew why Dzhokhar had never introduced him to his brother.

“Did he tell you ‘You don’t want to meet my brother,'” Silva said.

“Yes,” replied Silva. “He said his brother was very strict … very opinionated, and that since I wasn’t a Muslim, you know, he might give me a little (expletive) for that.”

Prosecutors say the Tsarnaevs committed the bombings to retaliate against the U.S. for wars in Muslim countries.

Silva recalled a discussion about American foreign policy during a high school class he had with Dzhokhar. Silva said Dzhokhar said U.S. foreign policy “tends sometimes to be a little hostile toward the Middle East,” persecutes Muslims and tries to “take over people’s culture.”

Under questioning from Tsarnaev’s lawyer, Silva said he didn’t recall Tsarnaev ever making strong anti-American statements and had posted on Twitter in November 2012 that he was celebrating the re-election of President Barack Obama.

The Ruger handgun was also used during a carjacking shortly after Collier’s killing and during a shootout with police in Watertown. A Watertown police officer testified Monday that Tamerlan Tsarnaev threw the gun at him when he ran out of bullets.

Tamerlan Tsarnaev died following the shootout and an escape by Dzhokhar, who ran him over as three police officers were trying to handcuff him on the ground.

Dzhokhar Tsarnaev was found hours later, hiding in boat parked in a Watertown backyard. On Tuesday, boat owner David Henneberry described how he discovered a wounded and bloodied Tsarnaev.

On April 19, 2013, Henneberry said, he received a call asking all Watertown residents to “shelter in place” while police were conducting a door-to-door manhunt for Tsarnaev.

He said after the restriction was lifted about 6 p.m., he looked outside and noticed that the shrink wrap on his boat looked a little bit loose. Henneberry said he put a ladder up against the boat, and when he looked inside, he noticed blood.

“I just kept fixating on this blood … my eyes looked on the other side of the boat and that’s when I saw a body on the boat,” Henneberry said. It was Tsarnaev, lying on his side.

The jury was shown more photographs of the inside of the boat, including a note Tsarnaev wrote in pencil on the interior walls. In the note, which prosecutors have characterized as a confession to the bombings, Tsarnaev denounced the U.S. for wars in Muslim countries.

“The US Government is killing our innocent civilians but most of you already know that,” the note said.

“I can’t stand to see such evil go unpunished, we Muslims are one body, you hurt one you hurt us all.”

Prosecutors also showed jurors two wooden slats where Tsarnaev carved the remainder of his note: “Stop killing our innocent people and we will stop.”

Testimony is scheduled to resume Wednesday.