Just a few years after the American Revolution, a group of seven white men worked together to write a document that would govern this new frontier — the Northwest Territorial Ordinance of 1787. In it, they included a clause outlawing slavery, making the Northwest Territory the largest region in the New World up to that time to have done so. And they also left out the word “white” in the document, opening up the potential for equal voting rights to all men, regardless of their color. And, as David McCullough showed in his book “The Pioneers,” African-American pioneers to the territory were voting. But when the white representatives to Ohio’s first state constitutional convention gathered in 1802, a majority decided to reverse the Northwest Territorial Ordinance, adding the word “white” to who could vote, stealing voting rights from African-Americans. And whites in every state formed from that territory would follow suit.

Ohio was not the only place to have early free and propertied African-American pioneers who were aware of their rights. African-Americans had been some of the earliest settlers of the Northwest Territorial frontier. Lawrence County, Ill. — where William Brown had been put up for sale in the 1850s — had been home to African-American pioneers before Illinois became a state in 1818. The Morrises, Andersons, Tanns and many other African-American families had been some of the earliest American pioneers in Lawrence County. They had come as propertied free blacks, building Fort Allison along the Wabash River before the War of 1812. They founded the integrated and abolitionist Mariah Creek Baptist Church in the early 1800s, and had fought in the War of 1812 under William Henry Harrison.

But no amount of success, patriotism or pride could protect these African-American pioneers, for these anti-immigration laws were a backlash against a rising and increasingly successful population of propertied African-Americans across the Northwest Territory states.

By 1851 whites in Indiana and Illinois created new state constitutions and passed laws completely barring any further free African-Americans from entering the states they helped to settle and defend. Whites in other Northwest Territory states from Ohio to Michigan passed laws to make those states unwelcoming to African-Americans. There were the notorious “black code bonds,” which required free African-Americans to find whites to sign for their good behavior and sign up or deposit a bond ranging from $500 to $1,000 in the earliest years of the 1800s, a time when a nice 100-acre farm in Massachusetts with a home and barns on it could be purchased for around $1,000. Ohio whites taxed propertied African-Americans for public schools their children were banned from attending, and whites in almost every one of those Northwest Territory states made it impossible for African-Americans to testify against whites in court.

And before each of these prejudiced laws was passed there was a rise in violent hate speech, much of it threatening genocidal violence against free people of African descent in those states. As the Saint Louis University scholar Silvana Siddali points out, this hate speech was overwhelmingly targeted at African-Americans and broadly published in newspapers. Many of the politicians had successful and propertied African-American residents in their districts, yet their hate speech was filled with false and prejudiced claims about the essential laziness and violence of African-Americans.

This hate speech and the subsequent theft of their rights did not go unnoticed or unchallenged. African-Americans pushed back, creating “Colored Conventions” that worked to undo the damage that racist whites had done in their states. In 1844, African-Americans who were gathering in their own political convention in Ohio, published their opening address asserting that “the Declaration of Independence, the American Bill of Rights, the Ordinance of 1787, as well as the Political Creed of every intelligent, generous and patriotic freeman, are clearly violated, nay shamefully desecrated, by that feature of our constitution that renders the color of the skin a qualification for electors.”

Most of these anti-immigration laws were not reversed until well after the Civil War was won — a victory made possible by African-American soldiers from across the Midwest, including William Brown. Mr. Brown survived the State of Illinois’s attempt to steal his freedom, and when it became possible for him to fight he volunteered from Indiana, his home state, to join the Union army, fighting in the terrible “Battle of the Crater” in Petersburg, Va. But even after he and other black soldiers from the Midwest had helped to preserve the Union and end slavery, whites in most of the Midwest still wanted to preserve white supremacy. When African-Americans started to arrive in Southern Illinois during the Civil War, they were described as “a worthless negro population” and “locusts.” And Indiana did not repeal all of the laws against African-American immigration in the state until 1881, 16 years after the end of the Civil War.

Now, as our own government takes a harsher and less humane stand against migrants, we would do well to remember the old anti-immigration laws that destroyed the rights of early patriots and pioneers all in the name of preserving the prosperity and pride of people who considered themselves “white.”

Anna-Lisa Cox is a fellow at Harvard’s Hutchins Center for African and African-American Research, a visiting scholar at Hope College, and the author of “The Bone and Sinew of the Land: America’s Forgotten Black Pioneers and the Struggle for Equality.”

The Times is committed to publishing a diversity of letters to the editor. We’d like to hear what you think about this or any of our articles. Here are some tips. And here’s our email: letters@nytimes.com.

Follow The New York Times Opinion section on Facebook, Twitter (@NYTopinion) and Instagram.