Medical schools are doing a better job of recruiting minority students, but they still struggle to keep those would-be doctors on the roster.

That's the conclusion of a new study that found minorities were more likely to leave than their white peers. And that can mean fewer doctors for under-served communities, the researchers added.

"We are reaching a state now where there should be more attention put on retention," said senior study author Dowin Boatright, an assistant professor of emergency medicine at Yale University in New Haven, Conn.

The study followed students who entered U.S. medical schools between 2014 and 2016. They looked at the rates of students who left school and noted their race/ethnicity, family income, and whether they came from a medically under-resourced neighborhood. Those neighborhoods were defined as ones with too few health care practitioners to meet community needs. All three factors were considered conditions that made a student "marginalized."

"We know that each marginalized identity brings its own unique challenges," said study author Mytien Nguyen, an M.D.-Ph.D. student at Yale School of Medicine. "So with multiple marginalized identities, we have compounding challenges."

The study, published online recently in JAMA Internal Medicine, found that students from these demographics were more likely to leave their programs early than other students.

The researchers said that students who checked off more of these boxes were even more likely to leave their programs, and students who met all the criteria for a marginalized identity were the most likely to leave medical school early.

"The admissions committee has already determined that these students are fit to be doctors and are academically ready," said Nguyen. "These are not individual challenges, but challenges students face because the medical environment, climate and system are not created for students from these marginalized backgrounds."

The researchers believe that by addressing societal issues like discrimination, mistreatment and cultures of exclusion, medical schools can hope to retain more of their students. Their future work will assess how schools are trying to keep their student bodies diverse.

"I think students from non-marginalized backgrounds are really being nurtured, while students from marginalized backgrounds are surviving," Nguyen said in a Yale news release. "And biologically, when you're surviving and managing stress, you're not able to perform at your best. With every student that leaves, it's not just a loss for the , but a loss for our patients as well."

More information: Visit the U.S. Centers for Disease Control and Prevention for more on how racial, ethnic or class discrimination can have consequences for health care treatment.

Journal information: JAMA Internal Medicine