Three college friends of Boston Marathon bombing suspect Dzhokhar Tsarnaev were arrested Wednesday and accused of removing his backpack and laptop from his dorm room three days after the attack in an effort to keep him out of trouble.

Azamat Tazhayakov and Dias Kadyrbayev were charged with conspiring to obstruct justice. Both appeared Wednesday in court, where they waived bail and agreed to voluntary detention pending a May 14 hearing.

The Justice Department said both men are 19-year-olds from Kazakhstan who were in the U.S. on student visas. Lawyers for both told reporters outside a Boston federal courthouse that their clients were cooperating fully with authorities.

A third man, Robel Phillipos, was charged with lying to investigators about the visit to Tsarnaev's room. He appeared in court Wednesday and was being held pending a Monday hearing.

For full coverage, visit NBCNews.com.

An FBI affidavit in the complaint against them says Tazhayakov and Kadyrbayev agreed to get rid of the backpack, which contained fireworks emptied of gunpowder, after concluding from news reports that Tsarnaev was one of the bombers. But Kadyrbayev's lawyer said Wednesday afternoon that his client didn't know when they threw away the backpack that it was linked to the bombing.

According to the affadavit, just after the FBI released its photos of the bombing suspects on April 18, Phillipos told Kadyrbayev the suspect looked like Tsarnaev.

When Kadyrbayev texted Tsarnaev that he looked like one of the suspects, the 19-year-old texted back "LOL" and then other messages Kadyrbayev interpreted as jokes.

"You better not text me," Tsarnaev wrote, adding, "come to my room and take whatever you want."

Later that night, according to the FBI affadavit, Tazhayakov, Kadyrbayev and Phillipos went to Tsarnaev's dorm room. Tsarnaev's roommate told them their friend had left a few hours earlier but invited the three in anyway.

While they watched a movie in Tsarnaev's dorm room, they noticed a backpack containing fireworks that had been opened and emptied of powder. It was then that Kadyrbayev realized his friend had been involved in the Boston Marathon bombing, according to the affadavit. He decided to remove the backpack from the room to help protect his friend, he told investigators, according to the affadavit; he also took Tsarnaev's laptop in order not to arouse the roommate's suspicions.

The three suspects then returned to the apartment where Kadyrbayev and Tazhayakov lived. There, they watched the news, and they decided to throw the backpack and laptop in the trash. Kadyrbayev put both in a black trash bag and dumped them into a nearby dumpster, he told investigators.

According to the complaint against the three, Phillipos lied to investigators during their initial interviews, giving them conflicting accounts of the night of April 18 and concealing that he and his friends had gone to Tsarnaev's dorm room. But on April 26, he confessed that he had lied and admitted that he had gone to Dzhokhar's room after Kadyrbayev texted him to.

He said that after the three had taken the backpack and laptop back to his other two friends' apartment, the three "started to freak out" as they realized their friend was the suspected Boston Marathon bomber.

Visit NBCNews.com for breaking news, world news, and news about the economy

Tsarnaev's discarded backpack was found April 26 in a landfill in New Bedford, Mass. It contained the fireworks, a jar of Vaseline and a UMass-Dartmouth homework assignment from a class in which investigators said Tsarnaev was enrolled.

Nothing stood out about Tazhayakov and Kadyrbayev's personalities, student Stephen Troio, who lived on the same floor as the men during his freshmen year at UMass-Dartmouth in 2011, told NBC News. But he remembered that the pair "did have a lot of money" and Kadyrbayev had "wrecked like three Beamers and then bought another one."

Kadyrbayev’s friends had given him a vanity license plate that said "Terrorista #1" for his BMW as a joke gift, his lawyer Robert Stahl told the AP.

Three people were killed and more than 260 injured in April 15 Boston Marathon attack when two bombs exploded near the finish line. The surviving suspect's brother and suspected fellow bomber Tamerlan Tsarnaev died after a gunfight with police several days later. Dzhokhar Tsarnaev was captured and lies in a prison hospital.

Tazhayakov and Kadyrbayev have been held in jail for more than a week on allegations that they violated their student visas while attending UMass. Linda Cristello, the Boston attorney who represented them at a hearing on the immigration case Wednesday morning, confirmed earlier that they were facing separate federal charges.

All three men charged Wednesday began attending UMass with Tsarnaev at the same time in 2011, the FBI affidavit says.

Boston police did not elaborate on why the three were arrested in their official announcement.

"Please be advised there is no threat to the public," the Boston Police Department said on its Twitter page. Police spokeswoman Cheryl Fiandaca referred all other questions to the FBI.

Until now authorities had identified just the Tsarnaev brothers as suspects in connection with the marathon attack.

Meanwhile, Tamerlan Tsarnaev's relatives will claim his body now that his wife has agreed to release it, an uncle said on Tuesday. Tsarnaev, 26, has been at the medical examiner's office in Massachusetts since he died after a gunfight with authorities more than a week ago.

Amato DeLuca, the Rhode Island attorney for his widow, Katherine Russell, said Tuesday that his client had just learned that the medical examiner was ready to release Tsarnaev's body and that she wants it released to his side of the family.

Police said Tsarnaev ran out of ammunition before his 19-year-old brother dragged his body under a vehicle while fleeing the scene. His cause of death has been determined but will not be made public until his remains are claimed.

"Of course, family members will take possession of the body," uncle Ruslan Tsarni of Maryland told The Associated Press on Tuesday night. "We'll do it. We will do it. A family is a family."

He would not elaborate. Tsarnaev's parents are still in Russia, but he has other relatives on his side of the family in the U.S., including Tsarni.

In another development Wednesday, a 26-year-old Chinese engineer who was carjacked by the Boston Marathon bombing suspects appeared on NBC's "Today" show, saying he was "lucky" to survive the agonizing 90-minute car ride that ended with his escape.

The man, who goes by the nickname Danny, appeared with his face concealed and his voice modified to describe his harrowing encounter with the Tsarnaevs on April 18.

“God was with me,” he said.