(Claritza Jimenez/The Washington Post)

Maryland prosecutors said they will drop rape and sex offense charges against two immigrant teens accused of attacking a 14-year-old classmate in a high school bathroom stall in a case that attracted international and White House attention and stoked the debate about illegal crossings into the United States.

After a court hearing Friday morning, prosecutors said they will drop the sex-assault case against Henry Sanchez Milian, 18, and Jose Montano, 17.

“The facts of this case do not support the original charges filed,” said Montgomery County State’s Attorney John McCarthy.

Defense lawyers had said for weeks that the sex acts were consensual and that text messages and school surveillance videos did not substantiate the girl’s claims she had been pushed from a hallway into a bathroom at Rockville High School on March 16 and that the suspects took turns assaulting her as she tried to break free.

As prosecutors moved to dismiss the rape cases, they began pursuing cases of child pornography charges related to images discovered on cellphones during the course of the investigation, according to court records and defense attorneys.

Maria Mena, attorney for one of the accused students, talks to the press as she departs the courthouse Friday in Rockville, Md. (Bill O'Leary/The Washington Post)

Prosecutors did not describe the content or path of the exchanges of the images. Defense attorneys said they were willingly shared by the girl with one defendant, who passed them along to the other.

Sanchez Milian’s attorney, Andrew Jezic, called the charges “selective prosecution of elective promiscuity,” adding that “it is hardly uncommon behavior for teenagers.”

Montano’s attorney, Maria Mena, said the child pornography laws are made to go after adults. She called the new charges “egregious.”

The developments Friday stood in stark contrast to the reports that pushed the case onto the national platform.

The severity of the reported assault — the girl originally told police the suspects held her down as she cried and repeatedly told them to stop — and that the two accused teens had entered the United States illegally only months earlier drew heated comments from the White House to the Maryland State House and to activists in the county.

Montano came to the United States from El Salvador, and Sanchez Milian from Guatemala. They were stopped at the border, detained, then allowed to continue on to relatives before they enrolled at Rockville at a ninth-grade level.

White House press secretary Sean Spicer was asked at a daily briefing about the cases in its early days and said, “The idea that this occurred is shocking, disturbing, horrific.”

“Part of the reason that the president has made illegal immigration and crackdown such a big deal is because of tragedies like this. . . . Immigration pays its toll on our people if it’s not done legally, and this is another example,” Spicer said.

Demonstrators converged on county government offices and hundreds of calls, emails and texts went to the school system, bashing undocumented immigrant students, assailing school policies and demanding the ouster of the superintendent. Police provided protection at the school after the threats.

In Annapolis, politicians referred to the case in denouncing legislation that would have limited cooperation between local police and immigration authorities. The legislation was defeated weeks later.

Immigration advocates and the county schools superintendent publicly spoke out about the charges, voicing horror and regret and also saying politicians should not judge immigrant children seeking a better life by the disturbing case. “We are a public school system, and we serve all of our students when they come to us,” Schools Superintendent Jack Smith said as the case broke, a position he repeated Friday.

And in the rippling effects, Sanchez Milian’s father, Adolfo Sanchez-Reyes, was taken into immigration custody.

U.S. Immigration and Customs Enforcement confirmed Friday that they are still pursuing Henry Sanchez Milian’s deportation to Guatemala, ICE spokesman Matthew Bourke said. Sanchez Milian is not yet in federal custody, but the agency has issued a detainer asking local authorities to ensure he is transferred to its custody.

Montgomery County Executive Isiah Leggett (D) said the county was cooperating with federal immigration officials because of the child-pornography charge filed against Sanchez Milian, and that the detainer would “be honored.”

At the White House, during the daily briefing Friday, principal deputy press secretary Sarah Huckabee Sanders was asked several times about whether Spicer had unfairly jumped to conclusions about the teens, and whether the White House regretted the rhetoric and would issue a retraction.

“We’re always looking to protect the American people. Sean was speaking about what he knew at the time,” she said. “I don’t want to retract anything without further information in front of me.”

On Friday, McCarthy, flanked by county leaders, said the decision to drop the charges followed an extensive investigation that included additional interviews and a review of medical records, school security videos, and phone and computer records. “Due to lack of corroboration and substantial inconsistencies from the facts,” McCarthy said, “the original charges cannot be sustained and prosecution of those charges is untenable.”

He declined to take questions from reporters.

In an interview, Leggett called the circumstances “a real tragedy and sad occasion.”

The case began March 16, when the girl told a staff member she had been raped. Detectives came to the school and spoke to the girl, who according to their affidavits, told them she knew Montano and they had been talking in a school hallway that morning.

She said he asked to have sex and when she refused, pushed her into a boys’ bathroom and pulled her into a stall, according to the police affidavits. Sanchez Milian then entered the stall, according to girl’s account in the affidavit, and both raped her as she cried out and told them to stop.

Montano “denied having any sexual contact with [the victim]. Montano stated they went into the bathroom to tell jokes,” detectives wrote after talking with him.

They also spoke with Sanchez Milian, who “initially stated nothing happened,” the police affidavits state, “then changed his statement multiple times and admitted having sex with the victim with his friend Montano.”

Faced with the choice of filing charges or not arresting the suspects as an investigation continued — and risking them fleeing — the police brought charges. Hours later, the two teens were locked in the Montgomery County Detention Center.

Defense lawyers had said for weeks there were major problems with the allegations.

The day before the incident, they said, the girl and Montano exchanged explicit text messages and images about planning to have sex in the school. Then, inside the school, surveillance video showed Montano and the girl walked together into the bathroom at the time of the incident, according to the attorneys. They also said the girl’s account of events was not consistent as the investigation progressed.

“At no point did the girl express any reluctance with any sex acts,” said Jezic. “From the night before, she actively planned a sexual encounter.”

Prosecutors considered pursuing a case of statutory rape, which holds that a victim is so young they cannot legally consent. To make such a case under Maryland law with a victim who is 14, the suspects must be a full four years older, said Jezic and other attorneys in the state.

In this case, neither Montano, at 17, nor Sanchez Milian, who is a relatively young 18, was a full four years older than the girl.

Jezic said he knows many people who followed the case will question that group sex in a high school bathroom could be consensual.

“It does seem improbable, if you are a person who is not connected to contemporary high school culture,” he said.

Therese Gibson, a parent and community activist who is part of Montgomery County Latino Advocacy Coalition, said she had no details about exactly what happened at Rockville High but found it unfortunate that the incident became politicized amid the national immigration debate.

“I think most students who come to the United States are coming to find a better life, and the vast majority are struggling to gain a foothold and do better than where they came from,” she said.

The case is not likely to be forgotten soon, she said. “It was such an explosive case when it started — the alleged rape of a young girl in a school,” she said. “I think people will remember this case for a long time. I hope this young girl heals and the immigrant community doesn’t suffer as a result of what happened.”

Maria Sacchetti, Donna St. George, Jennifer Jenkins, Abby Phillip and David Nakamura contributed to this report.