McCarthy Hall, a dormitory where a student made ricin, is photographed on the Georgetown University campus. (Katherine Frey/The Washington Post)

A federal judge ruled Monday that the Georgetown University student accused of making a deadly poison in his dorm room must remain in jail pending trial.

Richard W. Roberts, chief judge of the U.S. District Court for the District of Columbia, reversed a magistrate judge’s order that would have allowed the student, Daniel Milzman, to enter an in­patient psychiatric treatment program for at least two weeks.

Milzman, 19, was arrested in March after law enforcement officials discovered the biological toxin ricin in a desk drawer in his McCarthy Hall dorm room, court papers say. In two hearings last week, prosecutors and defense attorneys argued about whether Milzman intended to use the potentially lethal substance to hurt someone or to take his own life.

Prosecutors said in court filings that there was evidence Milzman may have wanted to poison a fellow student with whom he had a romantic relationship. Assistant U.S. Attorney Maia Miller quoted from cruel Facebook messages that she said Milzman sent the student in the months before he made the ricin.

Roberts said Monday that he was troubled by Milzman’s conversation on March 17 with a close friend, during which prosecutors said the sophomore denied being suicidal but said he was “definitely a threat to someone.” The friend notified Georgetown University counseling services, which alerted police, court papers say.

The judge also noted that when the friend asked Milzman whether he planned to use the ricin on the student who was the target of the Facebook messages, Milzman “shrugged,” according to prosecutors.

In addition, the judge said he was concerned that Milzman told law enforcement officials that he learned about the powdery substance from the hit TV show “Breaking Bad.” In the show, the central character uses ricin to try to poison his adversaries, not to kill himself.

Defense attorney Danny Onorato told the judge last week that Milzman, who graduated from Bethesda’s Walt Whitman High School, was struggling with depression and had created a lethal amount of ricin to take his own life. His decision to reveal to his friend that he had made the poison, Onorato said, was a “cry for help.”

Onorato said that Milzman, who faces a maximum prison sentence of 10 years, would be best served by intensive mental health treatment in a hospital program instead of at the D.C. jail. Milzman’s attorneys cited a report last year that found the D.C. jail ill-equipped to identify and handle suicidal inmates.

Roberts ordered Milzman held without bond and placed him on suicide watch. In his ruling from the bench Monday, the judge acknowledged Milzman’s depression but said the student’s mental health issues do not “eliminate the possibility that he intended to use it on someone else” and “may pose a threat to the community.”

Milzman’s “ability and determination” to make the ricin, Roberts said, “reflects the seriousness of the danger to others should he be released.”

After the hearing, Milzman’s parents — both doctors — and his two brothers were consoled by some of the nearly 90 classmates, colleagues and friends who filled the courtroom. Milzman’s family and his attorneys declined to comment on the judge’s ruling.