Immigration to the United States has come in swells and dips over the past two-plus centuries, driven by shifts in U.S. policy, the mood in the country and world events. Labor shortages, racial tension, economic forces, religious prejudice and national security concerns all fit into the picture.
"Here we are, the United States, a nation of nations, with the iconic symbol of the Statue of Liberty, and yet we are still arguing about the peopling of America," says American University historian Alan Kraut. "We are constantly in a tension between, on the one hand, a desire to be altruistic and the desire to serve our national interests."
In the modern era, the foreign-born share of the U.S. population hit a low of 4.7 percent in 1970. It's now near historic highs, hitting 13.5 percent in 2015.
At times welcoming, at times restrictive, immigration laws have helped shape the complexion of an increasingly diverse nation.
As President Donald Trump moves on building a border wall and considers restricting refugee flows, a look at the waves of immigration that have helped to determine the nation's identity:
Colonial welcome wagon
The U.S. has been regulating immigration since not long after it won independence from Britain, according to a paper by the Pew Research Center's D'Vera Cohn.
A 1790 law limited citizenship to "free white persons" of "good moral character" who had lived in the U.S. for at least two years. A series of laws in 1798 tacked on some strict enforcement provisions, including a requirement that noncitizens live in the U.S. for 14 years before naturalization. Some portions of the law were repealed in 1802 and others expired.
Overall, though, for its first 100 years, "the United States facilitated immigration, welcoming foreigners to a vast country," Philip Martin, a professor emeritus at the University of California, Davis, wrote in a paper for the Population Reference Bureau.
For many of those years, it brought in slaves, too, treating them as property, not citizens. In 1870, people of African origin gained citizenship rights.
Fleeing famine, seeking gold
The years from 1820-1870 saw an influx of newcomers from Northern and Western Europe, mostly German and Irish, providing needed labor. About a third came from famine-wracked Ireland, stoking anti-Catholic sentiments.
The gold rush and jobs on the transcontinental railroad also attracted Chinese immigrants, generating economic and racial resentments.
Starting in 1875, the U.S. began imposing restrictions on the types of immigrants it would allow. Among those banned: "criminals, people with contagious diseases, polygamists, anarchists, beggars and importers of prostitutes," according to Cohn. A series of laws also put growing restrictions on immigrants from China, and even provided for the deportation of Chinese nationals already in the U.S.
Later laws barred immigration from most Asian countries. Kraut says the push-pull between the need for more laborers and the tensions that immigration stirred led to a common expression: "America beckons, but Americans repel."
Another European wave
Between 1881 and 1920, more than 23 million people came to the U.S., mostly from Southern and Eastern Europe, aided by cheaper trans-Atlantic travel and attracted by employers seeking workers.
Around the globe, in a period of industrialization and easier travel, "there were more people on the move than at any other time in human history," says Kraut.
Then came the Great Depression and more restrictive laws, sending U.S. immigration into a long, steady decline. Laws enacted in 1921 and 1924 for the first time set quotas based on nationality.
In 1920, immigrants made up 13.2 percent of the population. In 1970, the number bottomed out at 4.7 percent.
In 1965, immigration policy underwent a dramatic shift from a quota-based system to one that favored the entry of people who already had relatives in the U.S. or had skills needed by employers. Since the enactment then of the Immigration and Nationality Act, immigration has been dominated by people from Asia and Latin America rather than Europe, according to Pew's Cohn.
Once the 1965 law kicked in, immigration started growing, with the immigrant population reaching 43.3 million people in 2015.
Where were all those immigrants from? The Americas, 53 percent; Asia, 30.6 percent; Europe, 11.1 percent; Africa, 4.8 percent, according to the Migration Policy Institute.
The architecture of the 1965 law still undergirds the U.S. immigration system. But changes in 1986 and 1996 that dealt with rising concerns about illegal immigration and terrorism are notable: The first legalized about 2.7 million immigrants living in the U.S. illegally (most of them from Mexico and Central America) and tried to crack down on the hiring of people in the country illegally, with poor results. The second expanded reasons for deporting people or ruling them ineligible to come to the U.S., and gave state and local police power to enforce immigration laws.
The years since the 9/11 attacks of 2001 have brought laws to broaden terrorism-related grounds for inadmissibility and deportation.
And now, President Donald Trump's focus on building a wall at the U.S.-Mexican border and his consideration of a plan to suspend the U.S. program for admitting refugees show there is still plenty of tension at the intersection of illegal immigration and national security.