When Wong Kim Ark returned from China to San Francisco, the city of his birth, in August 1895, he was denied entry into the United States on the grounds that even though he had been born in America, the chief immigration official of the United States didn’t believe you could be both Chinese and American. That immigration official, John H. Wise, a prominent Democrat and a son of the South, had been appointed to his position as collector of the customs a few years earlier. Wise called himself a “zealous opponent of Chinese immigration” and set out to vigorously enforce the Chinese Exclusion Act, a 1882 law that banned from America all Chinese laborers. It was the first law ever to block a specific ethnic group from entry into the United States.

Democrats and union leaders were solidly behind the Exclusion Act, seeing as a threat to the white working class the industrious Chinese miners, grocery store owners, vegetable growers and traveling doctors who had populated the West. The Democrats were supported by California’s Workingmen’s Party, founded by a firebrand Irish immigrant named Denis Kearney, who organized raucous and often violent rallies around the state where the crowd would howl “The Chinese Must Go” and call for building a wall on the southern border (sound familiar?) because they believed Chinese immigrants were sneaking in from Mexico, according to archival material.

In San Francisco, Wise embraced all sorts of tactics to stop the Chinese from entering the United States. When confronted with Chinese American citizens, he demanded they provide two white witnesses who could attest to their citizenship. His agents gave English-language tests, history quizzes and geographical exams to those wishing to return to America. Wise took sadistic pleasure in denying Chinese entry, penning poems about court victories to the immigration lawyers he had beaten. “So just to make this poor Wong Fong / feel very good and nice,” went one ditty, “I’ve sent him back to China, where he can eat his mice.”

Wise opposed the idea that Chinese people should be allowed to become Americans in part because the Naturalization Act of 1870 had barred Asians from becoming naturalized Americans, reserving that right only for whites, Native populations and blacks. In 1884, Wise and his agents blocked a Chinese American man from reentering America but lost the case in district court. In August 1895, Wise got his chance again when 21-year-old Wong Kim Ark arrived in San Francisco. Wise claimed that even though Wong had been born in San Francisco in 1873, he was not really a citizen.

To defend Wong, the Chinese Benevolent Association hired one of the city’s best attorneys. The U.S. government turned to Henry S. Foote, a former Confederate soldier who had served time as a prisoner of war during the Civil War. Foote asked whether any Chinese “by accident of birth” could ever become citizens if their parents were not and could never become naturalized citizens of the United States.

Trump’s rant about immigrants from “shithole countries” echoed Foote’s argument. Foote noted that Wong’s “education and political affiliations” were “entirely alien” to the United States. He was not and never could become an American, Foote said, but rather a “Chinese person and a subject of the Emperor of China.” Indeed, allowing Wong, who spent five months incarcerated on various steamships off the U.S. coast, into the United States would be dangerous, Foote argued, because Asians “must necessarily be a constant menace to the welfare of our country.”

Foote lost the case in district court, but the government decided to appeal, losing in the Supreme Court in a 6-to-2 decision in March 1898. Following the case, local worthies in San Francisco worried that the decision would tempt America’s minorities to angle for more rights. Two days after the verdict, the San Francisco Chronicle fretted that Japanese and Native Americans might even demand the right to vote. Perhaps, the paper suggested, an amendment to the Constitution to limit “citizenship to whites and blacks” might roll that back.

Things would not improve for decades for Chinese Americans and for Asian Americans in general. By 1924, the United States had constructed a web of legislation that effectively barred any Asian immigration. It would stay in place until World War II, when the United States was shamed into dismantling the ban by its ally China. Still, Trump and his advisers look to the time when the United States locked its doors to immigration as a golden era. No wonder his rhetoric sounds so familiar.