When New York City’s mayor began a move to revamp the program of selective schools last year, a public outcry ensued, and the issue has yet to be resolved.

Objections echoed those in the San Francisco Unified School District, which six years ago began in earnest the elimination of advanced mathematics classes until after 10th grade. Parents created Facebook groups to oppose the changes.

Many believe that children learn more effectively in schools or classes with similar learners, but are they right? It is a question that has long intrigued and divided people. When learners show different achievement levels, should we teach them separately or together? I have spent my career studying this question and, although the logic of separate classes seems strong, evidence leads us in a different direction.

Related: Ending racial inequality in gifted education

For instance, after San Francisco Unified de-tracked math, the proportion of students failing algebra fell from 40 percent to 8 percent and the proportion of students taking advanced classes rose to a third, the highest percentage in district history. Until 10th grade, students take the same mathematics classes. From 11th grade on, students can choose different pathways.

Eight Bay Area school districts found similar results when they de-tracked middle-school mathematics and provided professional development to teachers. In 2014, 63 percent of students were in advanced classes, whereas in 2015 only 12 percent were in advanced classes and everyone else was taking Math 8. The overall achievement of the students significantly increased after de-tracking. The cohort of students in eighth-grade mathematics in 2015 were 15 months ahead of the previous cohort of students who were mainly in advanced classes.

Recent national data show the same downsides to ability grouping: In the National Assessment of Educational Progress study for 2017, elementary schools that reported using reading groups “almost always” scored lower on average than those that used them “hardly ever.”

Why do these results arise? It seems to make sense that learners who are ready for different content are grouped together, and students who are high-achieving push ahead and take advanced classes, but there’s a problem with such an approach.

International studies show that the United States is one of the most tracked education systems in the world, but tracking hasn’t led to high achievement for the country.

We are at a point where the negative impacts of fixed-ability thinking are undeniable. And when we separate students into different classes, the message we send them is that their ability is fixed. When students, instead, embrace the knowledge that there are no limits to their learning, outcomes improve. When students develop a “limitless perspective” positive changes go through their lives, but when they get the opposite message — you’re smart, or you’re not smart — they constantly evaluate themselves against these fixed ideas. When young people believe their ability is more or less fixed, any struggle they encounter is devastating and can cause them to turn away from subjects.

In a film shared on youcubed.org that invited Stanford students to share the effects of the “gifted” labels they’d received, students talked about how the fixed labels had changed them in some unexpected ways. Some said they decided not to pursue engineering because they were not the best students in their chemistry classes (and presumed that could never change), while others shared that they’d learned they shouldn’t ask questions, as “gifted people are meant to know everything.” These are not ideas we want students to hold. They set students on unproductive learning pathways and cause them to shy away from difficult subjects.

Related: OPINION: From one white parent to another: Don’t pick schools because they’re selective and mostly white

The other reason that students do well in mixed groups is that teachers know they need to “differentiate” work, providing opportunities for students to take work to different levels. When work is open and students can extend their ideas to any level, high achievement is a possibility for any student. Tracked groups are often more limiting for students, as they allow teachers to presume they know what students need, and provide narrow questions that do not allow students to achieve highly and do not encourage students to engage in complex, interesting thinking.

This difference between tracked and untracked math experiences was illuminated recently in a survey we gave to San Francisco ninth-graders and ninth-graders across another large district, where all students are in tracked groups. The San Francisco students were significantly more positive about both mathematics and their own potential. Importantly, the San Francisco students were also significantly more likely than students in tracked groups to say that they enjoyed solving complex math problems, and that work was at the right level for them — neither too easy nor too hard.

International studies show that the United States is one of the most tracked education systems in the world, but tracking hasn’t led to high achievement for the country. Instead, it has brought about stark racial divisions in opportunity and achievement. We know that students need to know that they can learn anything and be provided with the opportunities to do so. Now is the time to invest in the teacher professional development that allows this to happen. For when we tell students they can reach the sky, and provide them with opportunities to do so, amazing things happen.

This story about separating gifted children was produced by The Hechinger Report, a nonprofit, independent news organization focused on inequality and innovation in education. Sign up here for our newsletter.

Jo Boaler is the Nomellini-Olivier professor of education at Stanford, co-founder of youcubed.org and author of the new book Limitless Mind: Learn, Lead, and Live Without Barriers by HarperOne.