In the United States, almost no one can trace their ancestry back to just one place. And for many, the past may hold some surprises, according to a new study. Researchers have found that a significant percentage of African-Americans, European Americans, and Latinos carry ancestry from outside their self-identified ethnicity. The average African-American genome, for example, is nearly a quarter European, and almost 4% of European Americans carry African ancestry.

Until recently, “human population geneticists have tended to ignore the U.S.,” says Joanna Mountain, a geneticist and senior director of research at 23andMe, a company in Mountain View, California, that offers genetic testing. With its long history of migrations from around the world, she says, the country was “considered to be kind of messy in terms of genetics.” But Mountain and her colleagues thought they might have a fighting chance of deciphering Americans’ complex genetic ancestry. Their secret weapon? 23andMe’s huge database of genetic information.

When a person signs up for a 23andMe genetic analysis, they can choose whether to make their data (with any identifying information removed) available for research. At the time when Mountain’s team compiled the database for their study, 23andMe had 500,000 customers, and about 80% of them had given their permission for their information to be used in that way. (Today, the company has about 800,000 customers.) That makes the data set used for the study “an order of magnitude bigger” than those usually used to examine population mixing, says Katarzyna Bryc, a population geneticist at 23andMe and lead author of the new paper.

The team started by looking at the average genetic ancestry of the three largest groups in the United States: European Americans, African-Americans, and Latinos. Those categories are based on how 23andMe customers defined themselves. But as you might expect in a country where different groups of people have been meeting and mixing for hundreds of years, the genetic lines between the groups are quite blurred.

“You see all of those different ancestries in each of these groups,” Bryc explains. The average African-American genome, for example, is 73.2% African, 24% European, and 0.8% Native American, the team reports online today in The American Journal of Human Genetics. Latinos, meanwhile, carry an average of 18% Native American ancestry, 65.1% European ancestry (mostly from the Iberian Peninsula), and 6.2% African ancestry.

The new study adds an unprecedented level of detail to patterns that had been noticed in previous, more general studies. For example, the 23andMe data reveals that the proportion of different ancestries, even within one self-identified ethnic group, vary significantly by state. Latinos with the highest proportion of African ancestry (about 20%) are from Louisiana, followed by states such as Georgia, North Carolina, New York, and Pennsylvania. In Tennessee and Kentucky, Latinos tend to have high proportions of European ancestry. And in the Southwest, where states share a border with Mexico, Latinos tend to have higher proportions of Native American ancestry.

At least 3.5% of European Americans carry African ancestry, though the averages vary significantly by state. In South Carolina and Louisiana, about 12% of European Americans have at least 1% African ancestry. In Louisiana, too, about 8% of European Americans carry at least 1% Native American ancestry.

In many states, the history of the region is written in the genomes of its current residents. Louisiana, for example, was a trading hub where different populations met and mingled. But sometimes the stories are even more specific. Oklahoma is the state where the most African-Americans have significant Native American ancestry, Bryc notes. That contact can be traced back to the Trail of Tears, when thousands of Native Americans were forcibly relocated to Oklahoma, which was also home to a significant number of black slaves. “You can really see historical events and historical migrations in the genetics,” Bryc says. “We weren’t actually expecting to be able to see that as clearly as we do.”

Another way that history shows up in contemporary genomes is in what researchers call a sex bias. By looking at the kinds of DNA that are passed down only by mothers, they can calculate how many of a person’s ancestors from each population were male and female. In all three populations, they found the same signal: European ancestors tended to be male, while African and Native American ancestors tended to be female. That imbalance reflects the fact that for much of U.S. history, European men were the most aggressive colonizers, Mountain says. This mixing seems to have started almost immediately after the first European colonizers and African slaves arrived in North America. “It suggests that really early U.S. history may have been a time of a lot of mixture,” Bryc says.

The fact that so many people in the United States carry a mix of different ancestries could have important medical implications. Today, doctors often assume that certain genetic variants are associated only with particular populations—think about sickle cell anemia in African-Americans, for example. But a person’s self-identified ethnicity—or the ethnicity her doctor assumes she is—doesn’t “necessarily correspond to [her] underlying genetics,” Bryc says. In a mixed population like the United States, it’s perfectly possible that a European American could carry the sickle cell variant that’s more common in African-Americans. In order for personalized medicine to live up to its potential, she says, doctors need to “consider the person” and her or his ancestry in all its complexity, rather than just falling back on reductive census categories.

The new study is “a beautiful piece of work,” says Andrés Moreno-Estrada, a population geneticist at Stanford University in Palo Alto, California, who has studied genetic diversity in Mexico and wasn’t involved with the new research. “The U.S. has a very particular genetic imprint compared to the rest of the Americas.” The 23andMe study “is one of steps forward in asserting that it’s possible to disentangle that complex scenario.”