Education secretary Betsy De Vos encountered groups of protesters on both sides of the immigration debate as she attended a Maryland elementary school close to the scene of an alleged rape by an undocumented immigrant.

The demonstrators met De Vos as she visited a school in Montgomery County, close to where a 14-year-old girl alleged she was attacked by two male students in an incident that has sparked an immigration debate.

Henry Sanchez, 18, and Jose Montano, 17, were charged with rape, with the victim alleging the attack took place at the Rockville High School's boys' toilets.

According to court documents, Sanchez has an immigration case that has been pending since 2016 – a fact anti-immigration demonstrators have used to further their cause.

Indeed, White House press secretary Sean Spicer said the case illustrated why President Donald Trump was keen to prioritise immigration policies.

"I think part of the reason that the president has made illegal immigration and crackdown such a big deal is because of tragedies like this," Spicer said in a statement.

Under US law, schools must educate people of school age regardless of whether or not they have legal status in the country.

Ahead of her visit to the elementary school close to where the alleged attack took place, DeVos said in a statement seen by the Associated Press: "As a mother of two daughters and grandmother of four young girls, my heart aches for the young woman and her family at the centre of these terrible circumstances.

"We all have a common responsibility to ensure every student has access to a safe and nurturing learning environment."

Rockville High School has received a number of threats, with police stepping up their presence in the area.

A spokesman for the school system, Derek Turner, told AP: "Now we're starting to receive calls that are threatening, saying they're going to shoot up the illegals in our school."

He added there was "a whole new level of vitriol that we haven't seen before" in the phone calls.