BOSTON – Three friends decided “collectively” to get rid of a backpack with fireworks tubes emptied of powder, a laptop and other potential evidence they found in Dzhokhar Tsarnaev’s dorm room, hours after learning their friend may have been one of the Boston Marathon bombers, investigators said in court papers charging the trio with federal crimes.

By the night of April 18, a few days after the bombing, several clues had convinced Dias Kadyrbayev and Azamat Tazhayakov, both from Kazakhstan, and Robel Phillipos, a U.S. citizen from Cambridge, Mass., that Tsarnaev and his older brother Tamerlan were the bombers sought in a massive manhunt, according to court complaints, signed by an FBI agent on the case.

Beyond FBI photos of the Tsarnaevs, the court filings lay out how the three 19-year-old men quickly tied Dzhokhar Tsarnaev to the attack: Tsarnaev’s comment a month before the marathon that he knew how to make a bomb, his text messages after the bombing saying they could take his belongings because he was “about to leave,” and potential bomb-making material in his dorm room, court papers said.

After authorities publicized the bombing suspects’ images about 5 p.m. April 18, the three men went to Tsarnaev’s dorm room and were let in by a roommate, papers said.

“Kadyrbayev decided to remove the backpack from the room in order to help his friend Tsarnaev avoid trouble,” the complaint said. “He decided to take Tsarnaev’s laptop as well because he did not want Tsarnaev’s roommate to think he was stealing or behaving suspiciously by just taking the backpack.”

At the New Bedford apartment shared by Kadyrbayev and Tazhayakov, the three friends discussed what to do with the items, and about 10 p.m., Kadyrbayev threw a black trash bag containing the backpack and fireworks into a trash bin near his apartment, court papers said.

Kadyrbayev and Tazhayakov were charged with willfully conspiring to commit an offense against the United States by destroying or concealing items to impede or influence a criminal investigation.

Phillipos was charged with knowingly and willfully making materially false statements to investigators by lying, saying he had not gone into his friend’s dorm room and did not remember anything being removed.

The three men were not accused of planning or participating in the Boston Marathon bombings that killed three people and wounded more than 260 on April 15.

Kadyrbayev and Tazhayakov face a maximum sentence of five years in prison and $250,000 fine. Phillipos faces a maximum sentence of eight years in prison and a $250,000 fine.

The three appeared Wednesday afternoon in federal court in Boston, shackled hand and foot. They voluntarily waived a bail hearing and said they can afford lawyers. Kadyrbayev and Tazhayakov are due back on court May 14 and Phillipos for a bail and probable cause hearing Monday.

Assistant U.S. Attorney Stephanie Seigmann said Kadyrbayev and Tazhayakov were here on student visas and had violated the terms of those visas. She described them as serious flight risks and said they may obstruct justice because they have already been accused of doing so.

But Kadyrbayev’s lawyer, Robert Stahl, said in court that he disputes that his client is here illegally and will fight removal proceedings against him.

After the hearing, Stahl said Kadyrbayev was “as shocked by the violence as the rest of the community” and did not know the items he allegedly removed were potential evidence.

“He did not know that those items were involved in a bombing,” Stahl said in a news conference.

“He assisted the FBI. He is very sorry for what happened here in Boston. He did not have anything to do with that.”

He said Kadyrbayev is a sophomore engineering student at the university and that the visa dispute occurred because he was not attending classes regularly this semester.

Tazhayakov’s lawyer, Harlan Protass, said his client too has “cooperated fully with the authorities.”

The court papers provide glimpses into investigators’ search for evidence and other potential accomplices hours and days after a bloody Tsarnaev was captured April 19

Tsarnaev was in custody just before 8:45 p.m., with University of Massachusetts identification, and that night, investigators had begun interviews with at least one of the three men, Phillipos.

Agents learned that a month before the bombing, Tsarnaev was lunching with the two men from Kazakhstan when he told them he knew how to make a bomb, court documents said.

The day the FBI released the bombing suspects’ images, Kadyrbayev had texted Tsarnaev to say he looked like the suspect, the FBI said. Tsarnaev’s reply contained “lol,” shorthand for “laugh out loud,” along with “you better not text me” and “come to my room and take whatever you want” — comments that Kadyrbayev interpreted as jokes, court papers said.

Then on April 18, before Tsarnaev’s roommate let them into the dorm room, Kadyrbayev shared a text message he had gotten from Tsarnaev, prosecutors said. “I’m about to leave if you need something in my room take it,” the message said, according to court papers.

In Tsarnaev’s room, the three watched a movie before noticing a backpack, opening it, and finding about seven firework tubes that were emptied of powder, court papers said.

“This discovery frightened Tazhayakov because the powder had been emptied from the tube,” prosecutors said.

Then they spotted a jar of Vaseline, court papers said, and Kadyrbayev told the others that he believed Tsarnaev had used the Vaseline “to make bombs,” court papers said.