Until the late 19th century, there wasn’t any such thing as “illegal” or “legal” immigration to the United States. That’s because before you can immigrate somewhere illegally, there has to be a law for you to break.

American immigration didn’t really begin until the late 1700s, when the United States became an independent nation. Before that, Africans had unwillingly entered the Americas as enslaved peoples and Europeans had entered as settlers—which is something totally different. While immigrants are beholden to the laws of the land they migrate to, settlers come to disrupt the current system and implement their own laws, write the scholars Eve Tuck and K. Wayne Yang.

But once the U.S. made its Constitution the new law of the land, immigrants flocked to the country with few restrictions. This didn’t mean that they were welcomed in the “New World.” In the beginning, when immigrants came mostly from northern and western Europe, anti-Irish and anti-Catholic sentiment were rampant. By the mid- to late-19th century, people from southern and eastern Europe as well as China were coming over, and Americans resented the presence of Chinese, Italians, and more Catholics.

The walls of a holding area in the Angel Island Immigration Station feature inscriptions from immigrants who were detained there. Due to prolonged questioning, some immigrants were detained for months, or even years.

Although some states like California passed local immigration laws during this time, these laws either weren’t well enforced or were thrown out by courts, says Madeline Y. Hsu, a professor of history at the University of Texas at Austin. In fact, there were no federal laws governing who could enter and who couldn’t until the Chinese Exclusion Act of 1882.

At the time, Chinese people worked in gold mines, factories, railroads, and agriculture, especially on the West Coast. Although these immigrants made up only .002 percent of the U.S. population, white Americans blamed them for low wages and other economic problems. To placate economic and racial anxieties, the radical exclusion act banned almost all immigration from China, making only a few exceptions for special groups like students and diplomats. In addition, the Immigration Act passed that same year banned people who were poor, mentally ill, or convicted of crimes from entering the country.

Because only a very narrow group of Chinese people could legally immigrate, “the acting presumption was that if you’re Chinese you must have come in illegally,” Hsu says. “Chinese become the only group required to carry around certificates of residence, which are intended to show—to document—that they have in fact entered legally.” In 1917, the Asiatic Barred Zone Act banned most immigration from Asia, as well as immigration by prostitutes, polygamists, anarchists, and people with contagious diseases.

Asian exclusion continued with the 1924 Immigration Act, which banned all people who could not become naturalized citizens per the 1790 Naturalization Act. That naturalization law had originally said that only free white people could become naturalized citizens. Yet by 1924, previously excluded groups like Mexicans, black Americans, and Native Americans had won citizenship rights, and the law really only applied to Asians.

But the biggest change the 1924 act made to immigration policy was introducing numerical caps or quotas based on country of origin. These quotas gave enormous preference to people from northern and western Europe over those from southern and eastern parts of the continent. Turns out, the previous restrictions on Asian immigrants had made “very little impact on the growing levels of immigration to the United States,” Hsu says, because the vast majority of immigrants came from Europe. These new quotas were meant to address “a sense of crisis” that America was accepting too many immigrants, particularly too many non-Anglo Saxon ones.

The 1924 act resurfaced in the news in September 2017 when United States Attorney General Jeff Sessions announced that the U.S. would end DACA (Deferred Action for Childhood Arrivals), a policy to give people who came to the U.S. as undocumented children a legal avenue to stay. Sessions had earlier stated that the 1924 Immigration Act “was good for America.”

But according to Mae M. Ngai, a professor of Asian American studies and history at Columbia University, “the 1924 act is considered almost universally to be a stain on our history.”

It’s an “obviously racist act,” she says. “It ranked people from all over the world on a kind of hierarchy of desirability based on their race and national origin … There is no controversy over that.”

Ellis Island’s Great Hall

The 1924 quota system remained largely in place until the 1960s, when a new law established a new system. Each year, there is a cap on the total number of visas that the U.S. can issue. According to U.S. Citizenship and Immigration Services, the U.S. cannot issue more than seven percent of the total allowable visas to one nation.

Before this change in 1965, there had been no numeric caps on immigration within the Americas. So when the U.S. decided that it would only take a certain percentage of people from each nation per year, it was the first time the U.S. had put an official cap on Mexican immigration.

Prior to this, Mexican immigrants freely, and commonly, found work in the United States. Yet after the Hart-Celler Immigration Act was passed, “Whole groups of migrants from Mexico and Latin America whose entrance to the U.S. would have been considered legal before 1965 suddenly became illegal,” writesJane Hong, a history professor at Occidental College, in The L.A. Times.

“There’s a lot of talk about the DACA students and [accusations] that it’s an unlawful program,” Hsu says. “The problem with that is that you can always change laws,” she continues. “Laws are constantly changed in order to accommodate actual circumstances.”

For example, it is a fact that Mexicans have already been immigrating to and living in the U.S. for a very long time. Whether lawmakers choose to consider that reality is another story.