Civil rights groups and educators denounced Education Secretary Betsy DeVos after she said schools can decide whether to report undocumented students and their families to immigration authorities.

DeVos made the comments on Tuesday during testimony before the House Committee on Education and the Workforce, in response to a question on whether principals and teachers should report undocumented students or families to Immigration and Customs Enforcement.

“I think that’s a school decision, it’s a local community decision,” she said. "And again, I refer to the fact that we have laws and we also are compassionate, and I urge this body to do its job and address and clarify where there is confusion around this.”

Rep. Adriano Espaillat, D-N.Y., who asked the question, immediately slammed DeVos' comments, saying that it's not up to local schools to define immigration policy.

“Let me just remind madam chair that immigration law is federal law. It's not local law," said Espaillat, who came to the U.S. from the Dominican Republic at age 9 and was undocumented when his family overstayed their visa. "You cannot have immigration law for one state be different than for another state. It applies to everybody across the country.”

After the hearing, educators and advocates also sharply disputed DeVos’ comments and noted a 1982 Supreme Court decision that states cannot deny students free public education based on their immigration status.

"We are shocked, incredulous and we're really upset that the leader of our public schools, the Education Department, would be so uninformed and wrong," said Rocío Inclán, a former Arizona teacher and director of the Center for Social Justice at the National Education Association, the nation's largest teachers' union.

When Inclán learned of DeVos' remarks, "I could see the faces of my students whom I taught in Arizona, many of whom I still am in contact with and who are DACA recipients themselves," Inclán said Wednesday, referring to the Deferred Action for Childhood Arrivals program. "I know the impact that her words are having right now in schools."

Inclán said that the Supreme Court's 1982 decision in Plyler v. Doe means that public schools cannot ask about a student or parent's immigration status, although sometimes students may confide in teachers.

"We do not collect data on that because it's illegal," she said. "I, as an educator, would never serve as Trump's immigration enforcement force."

Royce Murray, policy director at the American Immigration Council, which advocates for immigrant rights, agreed that schools should not be tasked with deciding whether to report undocumented students.

"The Supreme Court made it crystal clear that children, regardless of their immigration status, have the right to an education," Murray said on Wednesday. “In this current environment of heightened immigration enforcement, there’s a lot of fear in communities, and schools are supposed to remain a safe haven for children to go about their daily lives."

Royce questioned how educators would make a determination about a student's status before going to ICE.

"We don't want parents who speak Spanish to be afraid to come to parent-teacher conferences," she said.

Murray noted that even ICE designates certain “sensitive locations,” such as schools or places of worship, where enforcement action should not occur.

“ICE has only a handful of places that it designates as sensitive, and schools are one of them,” she said.

The Mexican American Legal Defense and Educational Fund, or MALDEF, said DeVos “desperately needs competent legal advice.” The Latino civil rights group represented the undocumented children and families in the Plyler case.

"Plyler is a constitutional decision so no individual teacher or school employee can provide information on a student to ICE because that would be denying them the education that Plyler guarantees," Thomas Saenz, president and general counsel of MALDEF, told NBC News. In an earlier statement, he called on DeVos to issue a clarification or resign.

When asked to comment on or clarify DeVos’ remarks, Education Department spokeswoman Elizabeth Hill said, “The secretary’s position is that schools must comply with Plyler and all other applicable and relevant law.”

A fact sheet on the Department of Education website says all children are entitled to equal access to public elementary and secondary education, regardless of their citizenship and immigration status, as well as that of their parents.

“School districts that either prohibit or discourage, or maintain policies that have the effect of prohibiting or discouraging, children from enrolling in schools because they or their parents/guardians are not U.S. citizens or are undocumented may be in violation of federal law,” the fact sheet says.

Inclán said DeVos' earlier comments "are already out there" and the damage has been done.

"She really needs to now be intentional about correcting, about educating about the law," Inclán said. "It's just unprecedented that we have had an official in her capacity undermine settled constitutional law."