BOSTON — A man linked to a gun used to kill a university police officer days after the Boston Marathon bombings told police he smoked marijuana every day because, in his words, “my best friend was the bomber,” according to court documents.

Stephen Silva was arrested Monday on charges of heroin trafficking and possession of a handgun with an obliterated serial number. The same gun was used to kill MIT police Officer Sean Collier during a manhunt for the bombing suspects, according to two people with knowledge of the case who spoke to The Associated Press on the condition of anonymity because they were not authorized to discuss the investigation.

Silva, 21, was a high school classmate and a close friend of Dzhokhar Tsarnaev, a suspect in the April 2013 Boston Marathon bombings that killed three people and injured more than 260. Collier, 26, was ambushed several days later and shot multiple times in his car.

Silva was arrested on marijuana charges at a train station in Boston’s Dorchester neighborhood in November. According to court documents, after transit police found two bags of marijuana and a wad of $555 in cash in Silva’s pockets, he repeatedly told them, “I smoke a lot of weed every day because my best friend was the bomber.”

George Hinson, who attended the Cambridge Rindge and Latin school with Silva, Silva’s twin brother and Tsarnaev, said Silva’s arrest came as a shock.

“He would not have given (Tsarnaev) the gun or hidden it if he knew he was a terrorist,” Hinson said. “Tsarnaev probably gave him a different story. He probably just wanted to make sure his friend was protected.”

Hinson said Silva and his twin brother, Steven, both initially enrolled at the University of Massachusetts-Dartmouth, where Dzhokhar Tsarnaev went, but the twins eventually transferred to the UMass campus in Boston.

“Steven was the pretty boy. Stephen was sort of the laid-back one,” Hinson said.

Cordelia van Heeckeren, who lives on the same floor of the high-rise apartment building in Cambridge where the Silva twins lived with their parents, said she was stunned when she saw FBI agents with hacksaws and other tools preparing to enter the Silvas’ apartment Monday. She said both twins seemed to have a regular group of friends and were generally well-behaved.

Jonathan Shapiro, an attorney for Stephen Silva, did not immediately return a call seeking comment Wednesday. On Tuesday, after Silva made his initial appearance in court, Shapiro said he had received the case only a few hours earlier.

“According to news reports, law-enforcement officials say it is the same weapon that was used … in the MIT officer Sean Collier shooting. However, this has not been charged in the indictment,” he said.

Shapiro said in a statement that he was in the process of meeting with his client and reviewing evidence in the case.

The court documents did not explain whether Silva believed his friend was the bomber because of news reports or through other knowledge. They also did not elaborate on why he said he smoked marijuana because of what he believed was his friend’s role in the bombing.

According to the indictment, Silva received the gun in or around February 2013. It said the gun “had the importer’s and manufacturer’s serial number removed, obliterated, and altered and had previously been shipped and transported in interstate and foreign commerce.”

The gun was recovered in suburban Watertown after Tsarnaev and his older brother, Tamerlan, allegedly shot at police and threw pipe bombs at them during the manhunt. Watertown police have said Tamerlan Tsarnaev fired the gun at them and then threw it at them when it ran out of bullets.

The indictment also alleges that Silva conspired to distribute heroin this summer in the Boston area.

Silva was ordered to remain in custody and a bail hearing was scheduled for Aug. 6.

Tamerlan Tsarnaev was killed in the shootout with police several days after the bombings. Dzhokhar Tsarnaev escaped but was soon found, wounded and hiding in a boat dry-docked in a backyard in Watertown.

He has pleaded not guilty and is scheduled for trial in November. He faces the possibility of the death penalty if convicted. His lawyer, Miriam Conrad, declined to comment on Silva’s statement to police in the marijuana case.

Four other men have charged in the bombing investigation.

On Monday, a federal jury found Azamat Tazhayakov guilty of obstruction of justice and conspiracy for trying to protect Tsarnaev by agreeing with another friend, Dias Kadyrbayev, to get rid of a backpack and disable fireworks they took from his dorm room. Kadyrbayev is to be tried next month on the same charges.

Robel Phillipos, who is charged with lying to investigators about being in the dorm room with Kadyrbayev and Tazhayakov the night the items were taken, is to have a separate trial in September. And a friend of Tamerlan Tsarnaev, Khairulluzon Matanov, is to be tried next year on charges that he lied to investigators about the extent of his friendship with Tamerlan Tsarnaev and the contact he had with both brothers in the days following the bombings.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.