A van carrying three college friends of Boston Marathon bombing suspect Dzhokhar Tsarnaev drives away from the Moakley Federal Courthouse in Boston, on Wednesday.

BOSTON — Two onetime classmates of Dzhokhar Tsarnaev, the surviving suspect in the Boston Marathon bombings, were charged Wednesday with conspiring to obstruct justice and destroy evidence, accused of discarding a laptop and a backpack containing fireworks belonging to Tsarnaev.

The men, Dias Kadyrbayev, 19, and Azamat Tazhayakov, 19, citizens of Kazakhstan who are in the United States on student visas, appeared in court Wednesday afternoon, the Justice Department said.

A third man, Robel Phillipos, 19, of Cambridge, Mass., was charged with lying to federal law enforcement officials about his role in disposing of the material, according to a criminal complaint against the men.

Two explosives detonated April 15 near the finish line of the marathon, killing three people and injuring more than 260 others.

Dzhokhar Tsarnaev, 19, and his brother, Tamerlan Tsarnaev, are suspected of having set off the bombs. Tamerlan Tsarnaev, 26, was killed in a shootout with police, while Dzhokhar Tsarnaev was caught and charged with using a weapon of mass destruction. He was transferred last week from Beth Israel Deaconess Medical Center in Boston, where he was being treated for multiple gunshot wounds, to a locked medical facility for male prisoners at Fort Devens in Massachusetts.

The three men charged Wednesday began attending the University of Massachusetts at Dartmouth in 2011. Dzhokhar Tsarnaev had become particularly close to Kadyrbayev and Tazhayakov, the criminal complaint said.

Kadyrbayev said he had shown Tazhayakov and Phillipos a text message from Dzhokhar Tsarnaev saying, “I’m about to leave if you need something in my room take it,” the complaint said.

In the room, they found a backpack containing “an emptied-out cardboard tube” that had previously contained fireworks and a jar of Vaseline that Kadyrbayev believed had been used “to make bombs,” the complaint said. The men then took the backpack, the Vaseline and Dzhokhar Tsarnaev’s laptop to Phillipos’ apartment.

After they saw news reports that Tamerlan Tsarnaev had been killed, Kadyrbayev said he threw the backpack in the garbage, the complaint said.

The backpack, according to the criminal complaint, contained “seven red tubular fireworks, approximately 6 to 8 inches in length.”

The backpack, which also contained a homework assignment sheet from a class in which Dzhokhar Tsarnaev had been enrolled, was eventually located by investigators at a nearby landfill in New Bedford, Mass., the complaint said. The complaint does not specify if the laptop was recovered.