More than a century before President Donald Trump began blocking arrivals from the Middle East and Africa, the American immigration debate was already being forged in the crucible of Chinese exclusion.
On May 6, 1882 -- the eve of the greatest wave of immigration in US history -- president Chester A. Arthur signed a history-making yet little-known piece of legislation called the Chinese Exclusion Act.
The law, not repealed until 1943, banned workers from the Middle Kingdom and ended naturalization for Chinese nationals -- the first time the US had singled out a particular nationality.
The new regime severely complicated life for more than 100,000 ethnic Chinese already in the US, many recruited to build the transcontinental railroad but facing racism from white workers.
This obscure yet resonant aspect of US history is explored in "The Chinese Exclusion Act," a timely new PBS documentary debuting on May 29 from Emmy-winning filmmakers Ric Burns and Li-Shin Yu.
"This is not simply an immigration story, it is the American immigration story," Burns told the Television Critics Association (TCA) in southern California in January.
The White House's biggest disagreements with Beijing these days center on trade rather than immigration, although liberals worry that Trump is ushering in a new era of isolationism with his "America First" rhetoric against migrants.
Burns and Yu examine the economic, social, legal, racial and political dimensions of the exclusion act, the events that gave rise to it and the effect it continues to have on American culture and identity.
Chinese Americans didn't have the vote, but the community filed some 10,000 lawsuits, establishing bedrock principles on birthright citizenship, access to education and equal protection under the law.
"In the process of resisting the discriminatory laws, the Chinese community helped define, in the most positive ways, what American citizenship is," said executive producer Stephen Gong.
- The 'China Question' -
The complex relationship between China and the US began with the founding of the republic, when trade with the Chinese emerged as crucial to American economic independence.
Through the dramatic westward expansion in the 1840s, supercharged by the Gold Rush, America became a bona fide global superpower.
Workers spilled into the new territory of California from the Pearl River Delta in southern China, seeking their fortune and fleeing the unrest precipitated by the Opium Wars.
"The Gold Rush for Anglo-America was a kind of shock therapy -- and an object lesson in the fact that there were other kinds of people on the planet," historian Kevin Starr, who died in January last year, tells the filmmakers.
"California was a laboratory for the larger process of adjustment that began nationally."
Eventually the gold mines began to dry up and Chinese immigrants became targets for reprisals by white miners whose resentments were inflamed by local politicians.
The transcontinental railroad, completed in 1869, brought cheap labor east and virulent racism against the Chinese spread country-wide, fanned by the economic crash of the 1870s.
Suddenly the "China Question" was front and center in the theater of American political debate.
"We have today to decide whether we shall have on the Pacific coast of the United States the kingdom of Christ or the kingdom of Confucius," then-senator James G. Blaine, a Republican from Maine, told fellow legislators.
- Racist purges -
The Chinese Exclusion Act was passed and racist purges multiplied catastrophically as 300 towns and cities from Wyoming to Oregon turned against their Chinese American inhabitants.
Inter-racial marriages were banned, while the authorities prevented Chinese Americans from returning after visiting loved ones back home and barred the Chinese from owning property and businesses.
The act formed the foundation of American immigration policy, implemented with cold-blooded efficiency at the Angel Island barracks in San Francisco harbor.
Between 1910 and 1940, 175,000 Chinese immigrants passed through the station, but 18 percent of newcomers were rejected, often after grueling interrogations and harrowing detentions.
The anti-Asian discrimination was extended in 1917 to bar workers from an area that stretched from Japan to Turkey -- ushering in immigration restrictions that would endure for half a century.
Activists note that when Congress repealed the act, the US was in the throes of World War II and primarily concerned that Japan was citing the law in propaganda questioning China's alliance with Washington.
The United States still let in only 105 Chinese each year, and didn't open up to large-scale immigration by non-Europeans until a landmark 1965 law championed by then senator Ted Kennedy.
The US House of Representatives formally expressed regret for the country's anti-China policies in 2012, eight months after the Senate had passed its own apologetic resolution.
"If there is a word that defines the Chinese-American experience, and Asian-American experience, it's exclusion," Ling-chi Wang, professor emeritus at UC Berkeley, tells the filmmakers.
A fog bell on California's Angel Island, where America's anti-Chinese immigration policy was implemented with cold-blooded efficiency