Charles King, a professor of government at Georgetown University, is the author of “Gods of the Upper Air: How a Circle of Renegade Anthropologists Reinvented Race, Sex, and Gender in the Twentieth Century.” This article is adapted from his book.

Just released from prison and working on the final edits of “Mein Kampf,” Adolf Hitler could think of only one country in the world that really understood what he was getting at. The United States was alone, he wrote, in showing “at least the weak beginnings toward a better conception”of a proper social order.

A recent wave of historical research has uncovered the degree to which the Nazis were not so much inventing a race-obsessed country as copying one. Books by James Q. Whitman, Katherine Benton-Cohen, Richard Rothstein, Daniel Okrent, Mae Ngai and others have defined a new — and astonishing — interpretation of the lead-up to World War II.

The war was a global contest among political systems, but the uncomfortable truth is that it was also a fight among intellectual siblings. America’s enemies saw themselves as more advanced versions of what they believed Americans had been trying to achieve all along: racial segregation, the extermination of primitive peoples and a world order that placed the fittest human beings squarely on top.

That legacy reasserts itself today, in chanting crowds and demagogic politicians whose idea of “real Americans” looks painfully close to that of the eugenicists and anti-immigrant activists of the 1920s and 1930s. Yet intertwined with this bleak history is another American story: one of daring resistance to nationalism, disenfranchisement and xenophobia. It lay not in the country’s foundational documents such as the Declaration of Independence and the Bill of Rights. American leaders of the era had long seen these as fully compatible with racial exclusion and ethnic nationalism — as some still do today.

Rather, it resided in a body of discoveries made by a small band of renegade researchers who set out to demonstrate the essential unity of humankind. Like any new scientific claim, their findings were hard to accept. They flew in the face of established knowledge about human difference. Even now, old ideas about race, biology and the hierarchy of human types still have currency — not least among the people whose social power they reinforce. But today, when you visit a museum or fill out a census form, or when your child walks into her eighth-grade health class, the effects of this quiet revolution are there to see.

By the time Hitler published his screed on the perils of race-mixing and Jewish domination, the United States had perfected the most far-reaching system of racial exclusion practiced by any major power. Most states had some form of mandatory segregation in schools, housing, public offices, swimming pools or cemeteries. In 1924 federal immigration law was redesigned to increase the percentage of people who claimed northern European ancestry. In 1927 the Supreme Court upheld the government’s right to sterilize a person deemed mentally incompetent. In museums, university classrooms and charitable organizations, a strong consensus held that people came packaged in neat categories such as “civilized” and “fit,” or “primitive” and “deviant.”

But standing against these trends was a contrarian professor named Franz Boas. He had come to the United States from Germany in the 1880s, arriving in New York after more than a year of amateur fieldwork in the Canadian Arctic. He worked on the staff of the Chicago World’s Fair and bounced around as an itinerant academic, before finally landing a professorship in anthropology at Columbia University.

In 1911 Boas completed a major study examining the effects of immigration on the American body politic. After taking physical measurements of thousands of New Yorkers, he concluded that the “adaptability of the immigrant seems to be very much greater than we had a right to suppose before our investigations were instituted.” Children born in the United States had more in common with other U.S.-born children than with the national group represented by their parents. The natural “types” into which people were usually categorized — their races or ethnic groups, for example — were inherently unstable. And if they were unstable, they couldn’t be used to explain allegedly permanent differences in intelligence, criminality or other traits.

Over the next three decades, Boas repeated his findings whenever he had the chance. The idea that anything at all, positive or negative, was inherent to a specific race was “at best a poetic and dangerous fiction,” he told a conference of eugenicists in 1937. He was arguing against the dominant opinions of the time, and the backlash was severe. The FBI opened a file on him. Columbia cut his research funding. Nazis pulled his books from the shelves of German libraries and burned them.

Boas lived long enough to see scientific racism fully triumph in his homeland — and to see his ideas vindicated in his new home. He died in December 1942, during a luncheon at the Columbia Faculty Club. That same month, the Allies finally issued a statement acknowledging the systematic killing of the Jews of Europe. The New York Times published a special note commemorating the untimely loss. It now devolved to Boas’s students, the Times wrote, to carry on “the work of enlightenment in which he was a daring pioneer.”

They would go on to become some of the century’s intellectual stars: Margaret Mead, who decoupled the concepts of sex and gender; Ruth Benedict, whose research on Japanese culture helped shape the postwar occupation; Zora Neale Hurston, whose ethnographic studies under Boas fed directly into her classic novel “Their Eyes Were Watching God”; and other academics who created some of the world’s foremost departments of anthropology.

Boas’s students traveled around the world — Mead to Samoa and Papua New Guinea, Hurston to the Gulf Coast and the Caribbean, others even farther afield — to prove one basic point. The deepest science of humanity, they believed, was not one that taught us what was unchangeable about human nature. Rather, it was one that revealed the wide variation in human societies: the diverse vocabulary of propriety, custom and rectitude.

They named their animating theory cultural relativism. For nearly a century, critics have accused Boas and his successors of everything from justifying immorality to furthering the batty idea that the United States might not be the greatest country that has ever existed. But their core message was that, to live intelligently in the world, we ought to suspend our judgment about other ways of seeing social reality until we really understand them. In turn, we should look at our own society with the same skepticism with which we study far-flung peoples.

Cultural relativism was a theory of human society, but it was also a user’s manual for life. It was meant to enliven our moral sensibility, not extinguish it. There might well be such a thing as a universal moral code, Boas taught, but no society — not even our own — has a lock on what it might contain. A given culture typically preens itself into believing that its foodways, family structure and political system are the truly logical ones. If there is any moral progress at all, it lies in our ability to break that habit: to develop an ever more capacious view of humanity itself.

This is the scientific finding and moral disposition that Boas and his students wanted to share with the world. Focus less on the rules of correct behavior — eat this, don’t touch that, marry him — and more on the circle of humanity to which you believe the rules apply. Figure out what your own society thinks of as its best behavior, and then extend that to the most unlikely recipient of your goodwill. Work hard at distancing yourself from any theory that feeds your sense of specialness.

American history doesn’t arc toward justice so much as oscillate in its general vicinity. A country that once led the world in the science of exclusion also managed to produce a data-driven theory of the essential unity of human beings. If it is now unremarkable for a gay couple to kiss goodbye at the airport, for a college student to read the Bhagavad Gita in a Great Books class, for racism to be rejected as both morally bankrupt and self-evidently stupid, and for anyone, regardless of their gender expression, to claim workplaces as fully theirs — if all of these things are not innovations but the regular, taken-for-granted way of organizing a society, then we have the ideas championed by the Boas circle to thank for it. The fact that all of this is a continual struggle — to live within a society and be critical of it at the same time — was precisely the point they wanted to convey.

“There is no evolution of moral ideas,” Boas wrote in 1928. All societies he studied contained people you welcome and those you reject, people to whom you owe the truth and those to whom you were expected to lie. He never encountered a country that fell apart because its inhabitants loved it too little. The problem was normally the opposite: the unchecked self-regard that puts our brand of humans at the top of nature’s heap. If there is any hope for a better world, it lies in the daily effort to expand the circle of those we believe should be treated as full, purposive and dignified human beings.