White House press secretary Sean Spicer landed Maryland in the middle of the nation’s emotionally charged debate over immigration policy Tuesday, decrying the rape of a Rockville High School student, allegedly by two undocumented immigrants, and urging state and local officials to reexamine laws and procedures to reduce the likelihood of such an incident happening again.

“The president recognizes that education is a state-run and a ­local-run issue, but I think it is cause for concern what happened there,” Spicer said in response to a reporter’s question about the case. “And I think the city should look at its policies, and I think that this is something authorities are going to have to look at.”

Spicer called the rape of the 14-year-old girl in a boys bathroom on Thursday “shocking, disturbing, horrific and whatever other words that someone can think of.” He also characterized the victim as an immigrant who had come to this country legally. But Montgomery County officials said she had no immigrant status of any kind.

The two suspects, Henry Sanchez-Milian, 18, and Jose O. Montano, 17, who was charged as an adult, are being held without bail. Montgomery Schools Superintendent Jack Smith told reporters that both suspects had been in a special program for non-English speakers at the high school and not in classes with the victim.

Smith pushed back hard against questions about whether the rape case should affect local efforts to comply with federal law, which guarantees a free public education to any child living in the United States, regardless of citizenship status.

Henry Sanchez-Milian, 18, is charged with the rape of a 14-year-old Rockville High School student. (Montgomery County Police)

“It’s totally inappropriate to suggest that we’re going to deny a 14-year-old, a 16-year-old, an ­18-year-old an education because of a horrible thing that happened in our schools last Thursday,” Smith said. “Some have tried to make this into a question and issue of immigration . . . but we serve every student who walks through our doors.”

The incident is also affecting the political debate in Annapolis, where Gov. Larry Hogan (R) has vowed to veto legislation that would limit the ability of state and local officials to cooperate with federal immigration agents in enforcing the nation’s immigration laws. The Trust Act passed the House on Monday and is awaiting action in the Senate.

In a Facebook post Tuesday, ­Hogan called on Montgomery to “fully cooperate with all federal authorities during the investigation of this heinous crime.”

“The public has a right to know how something this tragic and unacceptable was allowed to transpire in a public school,” Hogan wrote.

The comments incensed Montgomery officials, who said they already have a policy of cooperating with federal authorities in any serious criminal case. They accused Hogan of stoking public fears of crimes committed by undocumented immigrants.

“What he’s feeding into is this Trump energy against immigrants in a manner that I think is totally irresponsible,” said Montgomery County Council President Roger Berliner (D-Potomac-Bethesda). “It has inflamed what was already a tinderbox.”

The suspects were unknown to county law enforcement before the rape and have no known gang connections, officials said, adding that the assault occurred in a remote area of the school.

“There was nothing that could have come to the attention of our local authorities where they could have acted,” said County Executive Isiah Leggett (D).

Montgomery police are barred from asking about national origin during traffic stops or other activity. Immigration status comes into play only if a person enters the county correctional system. All prisoners’ fingerprints are placed in a database that federal authorities can use. If they identify someone who is in the country illegally, they can issue a detainer — a request that the county hold the prisoner until he or she can be placed in federal custody.

Since 2014, Montgomery has honored detainers when they involve those who have committed serious crimes or if they come with a federal court order or a warrant containing probable cause. The Trust Act bill being debated in Annapolis would codify those procedures into state law.

State Sen. Victor R. Ramirez (D-Prince George’s), the lead Senate sponsor, said the legislation is intended to protect the vast majority of undocumented immigrants, who are law-abiding after arriving in this country, not those who commit heinous crimes. “We all should take in consideration the hard-working Maryland residents who . . . have children, have ties to the community and don’t have a criminal record,” he said.

The bill passed the House 83 to 55, two votes short of the minimum needed to override a gubernatorial veto. The Senate Judicial Proceedings Committee is expected to vote on both the House and Senate versions this week.

Senate President Thomas V. Mike Miller Jr. (D-Calvert) said the bill is “reasonable,” and he accused Hogan of misinterpreting what the statute would do.

“The state of Maryland is not going to become a sanctuary state,” Miller said. “But what it does say is that if you are on your way to church, on your way to court, if you are walking down the street, people shouldn’t come up to you randomly and ask you what your name is or where you live solely for the purposes of seeking to deport you.”

Parents in Montgomery have reacted to the rape with alarm. Many came to Rockville High on Tuesday night for a meeting with local officials. The session was closed to reporters. Patricia ­Spigner, who lives in Gaithersburg and has three grown children, came to the school to protest what had happened.She held a poster that said “Safety not sanctuary!”

“It’s just gotten to the point where illegals are more protected than our own children,” she said.

At the news conference earlier in the day, Smith noted that there are nearly 160,000 students in the school system and said that “this horrible incident shouldn’t change anyone’s mind that schools are safe for our students.” He said the district was reviewing “every single aspect” of its safety plans and will make sure any gaps are closed.

Josh Hicks contributed to this report.