The Montgomery County Courthouse in Rockville (Dan Morse/The Washington Post)

Maryland prosecutors have dropped child pornography charges against Rockville teenager Henry Sanchez Milian, quietly ending a case that erupted onto the national stage when Sanchez Milian and a friend — who each entered the country illegally last year — were accused of raping a classmate in a school bathroom.

“I am grateful to God,” Sanchez Milian’s stepmother, Lorena Hernandez, said outside of court Friday. “Now there is light at the end of the tunnel.”

With the dismissed charges, Sanchez Milian no longer faces any counts from incidents that unfolded on March 16, when a 14-year-old student at Rockville High School told school officials and detectives she had been forced into a bathroom stall, held down and attacked.

Sanchez Milian, 18 at the time, and Jose Montano, 17 at the time, were charged by Montgomery County police with rape and sex offense counts, punishable by life in prison. Montano was charged as an adult.

In the two months that followed, however, prosecutors studied high school surveillance video, reviewed phone records, spoke to the girl and others, and concluded the original claims could not be corroborated. Defense attorneys had been telling prosecutors for weeks that the sex acts had been consensual.

Henry Sanchez Milian (Montgomery County Police)

In May, prosecutors dropped the rape case but filed charges against the suspects related to possession of child pornography. According to their new case, ­before March 16, Montano had engaged in lewd text exchanges with the 14-year-old, and she sent him images of herself unclothed. Montano then forwarded the ­images to Sanchez Milian, prosecutors said.

Defense attorneys did not deny that sequence of events, but they blasted prosecutors for what they said was a stretch of child pornography laws designed to go after adults. Montano’s attorneys resolved his pornography case in juvenile court when he admitted to possessing one of the images.

But Sanchez Milian — who had stayed in the adult court system — was facing trial on child pornography charges at the end of October. His defense attorneys had dug in for a fight, establishing in hearings that they had the legal right to call the girl to the witness stand for questioning about whether the images in the texts were of her.

Prosecutors, who had contended they could make their case without her testimony, said Friday that having her testify would needlessly traumatize a teenage girl who has suffered mental-health issues. Having her called as a witness also would go against the wishes of the girl’s family, prosecutors said in court.

“The parent of the victim expressed significant concerns that participation at trial would be detrimental to the physical and mental well-being of the child,” Assistant State’s Attorney Mary Herdman said in court, reading from a document she submitted as part of the record dropping the child pornography case.

Herdman said prosecutors wanted “to protect this vulnerable child from further harm in this matter.”

Prosecutors have said that they earlier had considered pursuing a case of statutory rape, which holds that a victim is too young to legally consent. But under Maryland law, to make such a case with a victim who is 14, the suspects must be a full four years older, according to prosecutors and defense attorneys. In this case, neither Montano, at 17, nor Sanchez Milian, who was a relatively young 18, was a full four years older than the girl.

Andrew Jezic, an attorney for Sanchez Milian, said prosecutors made the right decision for all involved. "It's such a sad case," he said. "We just hope and pray the girl and her family find peace."

Sanchez Milian, a native of Guatemala, and Montano, from El Salvador, were stopped at the U.S. border last year, detained, and then allowed to continue on to relatives in Montgomery County, where they enrolled at Rockville High at the ninth-grade level.

Their immigration status, and the brutality of the original accusations, caught the attention of the White House and drew international notice.

Though the Maryland criminal cases have come to an end, Sanchez Milian and Montano face possible deportation.

After court Friday, Sanchez Milian was taken back to the Montgomery County jail, according to his attorneys. He is being held there, for a limited time, because immigration agents had earlier lodged a detainer against him, according to jail officials.

David Moyse, one of Sanchez Milian's attorneys, said he expected immigration officials to take custody of his client and start the deportation process. But Sanchez Milian has a strong case for staying in the United States and attempting to seek legal status, Moyse said.

“Henry had never been in any trouble prior to these allegations,” he said. “He’s got no criminal convictions or connections to gangs. He doesn’t even have a speeding ticket.”

Montano's attorneys also are trying to keep him in the country. Attorney Jose Canto said Friday that immigration officials have launched a removal case against his client.

Canto is seeking asylum protection for Montano, in part because some media coverage of the rape allegations indicated Montano may have been a member of the MS-13 gang. Montano never belonged to MS-13, Canto said, but the label could put him in danger from rival gangs, or MS-13, if he were deported to El Salvador.

“Jose just wants to go to school and take advantage of the opportunities this country offers,” Canto said. “Unfortunately, he and Henry became the faces of the illegal immigration debate in this country.”

(This file has been updated to include a definition of statutory rape in Maryland.)