During the past few years, the Trump administration has been stoking an on-again, off-again trade war with China. By levying tariffs on Chinese imports, restricting immigration of Chinese students and skilled workers and moving to cut off TikTok and WeChat from American users, the administration has repeatedly erected economic and legal barriers between the United States and China. Even after months of shifting goals and deadlines, the Trump administration’s approval of a modified deal to allow TikTok to continue to operate in the United States has succeeded only in increasing the uncertainty for businesses operating between the United States and China.

But China has been economically important to the United States since the Revolutionary War — so much so that Americans spent most of the 19th century trying to lower physical barriers to trade with China. To do so, they undertook one of the largest infrastructure projects in the history of the United States: building the transcontinental railroads.

Between the end of the Civil War and the start of World War I, Americans built multiple railroads across the continent. Historians have explored these railroads’ effects on the United States in great detail: how the railroads flooded the North American West with White settlers, pushed corporate power to new heights and enabled environmental devastation.

But Americans at the time also saw railroads in global terms. They believed transcontinental railroads to Pacific harbors would make it easier for the United States to import valuable Chinese commodities, especially silk, tea and spices. Americans’ beliefs about the value of transpacific trade informed every aspect of the transcontinental railroads. This history shows how deeply trade with China is woven into the American fabric and suggests President Trump’s hostility toward China is unlikely to outlast his administration.

At first, expanding the nation to the Pacific Ocean seemed ludicrous. In the early 19th century, it took months to even cross the continent. Americans worried any settlements on the Pacific Coast would quickly break away from the distant United States, just as they themselves had revolted against far-off Britain. The Rocky Mountains, they believed, would create a natural barrier to territorial expansion. Even Thomas Hart Benton, the Missouri senator and otherwise ardent expansionist, proposed “the statue of the fabled god, Terminus, should be raised upon [the Rockies’] highest peak” to mark the nation’s western border.

The railroad’s invention changed everything. High-speed steam-powered rail transportation promised to shrink the globe and profoundly altered how Americans imagined their country’s future. In 1845, Asa Whitney, a New York merchant in the China trade, proposed a railroad to the Pacific Ocean to carry “the teas and rich silks of China” across the continent. Suddenly, it seemed not only possible but lucrative for the United States to reach the Pacific Ocean.

In 1844, a wave of expansionist enthusiasm swept President James K. Polk into office. Polk quickly identified “the acquisition of California and a large district on the coast” as one of the “four great measures of my administration.” Polk wanted harbors: San Francisco Bay and Puget Sound were avenues “through which the commerce of our western States can be profitably conducted with Asia,” wrote James Buchanan, Polk’s secretary of state. Through diplomacy and bloodshed, using the 1846 Oregon Treaty and the 1846-48 U.S.-Mexico War, Polk nearly doubled the nation’s territory and gained those valuable Pacific harbors.

American expansionists quickly cast their gaze across the Pacific Ocean. De Bow’s Review, the commercial trade press of the slaveholding South, argued trade with China belonged to the United States. “China, from its geographical situation and physical products,” the journal argued, “is more important to us than to Europe.” Benton abandoned his Terminus statue; he now saw the Rockies as merely “this little intervention of dry ground between Canton and New York."

The first American Transcontinental Railroad opened to enormous celebrations in 1869. Harper’s wrote the new railroad would enable the “union” of China and the United States. Benton revived his statue idea: How about one of Christopher Columbus, astride the Rockies and pointing west toward Asia? Americans believed the railroad would make the United States essential to international trade. Walt Whitman captured the national mood in “Passage to India,” published two years after the railroad’s completion. “I see over my own continent the Pacific Railroad, surmounting every barrier,” Whitman wrote. “Bridging the three or four thousand miles of land travel,/Tying the Eastern to the Western sea,/The road between Europe and Asia."

This railroad could not have been built without Chinese labor. Central Pacific, which built the railroad’s western half, relied on a workforce that was 90 percent Chinese. (Northern Pacific and Southern Pacific, the next two transcontinental railroads built, also relied heavily on Chinese workers, who made up between half and three-quarters of their workforces.) Railroad work was grueling and dangerous: Central Pacific’s Chinese workers carved 15 tunnels through the Sierra Nevada Mountains with chisels and blasting powder. At least 1,200 of them died. Union Pacific, which built the eastern half, employed mostly Irish immigrants, and Harper’s saw a metaphor in these Irish and Chinese workers. “The very laborers upon the road typify its significant result,” the magazine wrote, “bringing Europe and Asia face to face, grasping hands across the American Continent."

To everyone’s surprise, the first Transcontinental Railroad initially carried little freight from China. “None of us dreamed that the future of the Pacific roads depended more on the business that would grow out of peopling the deserts it traversed, than on the through traffic,” one Union Pacific executive later wrote. (This was partly because the Suez Canal also opened in 1869, creating a faster all-water route for commerce between Asia and Europe.)

This apparent failure did little to dent American enthusiasm for Chinese trade. Neither did White Americans’ rising xenophobia toward Chinese immigrants, which culminated in the 1882 Chinese Exclusion Act. Just a year later, in 1883, residents of St. Paul, Minn., celebrated the completion of the Northern Pacific Railroad with a parade that stretched for 15 miles. Marchers proudly passed through the Chinese Arch, beneath the words “NPRR, the connecting link between China and St. Paul."

Other railroads quickly followed: Great Northern, completed in 1893, named its flagship train “the Oriental Limited,” an American version of Europe’s “Orient Express,” and built two steamships to provide continuing transpacific service from its Seattle wharves. Even Milwaukee Road, the last Transcontinental Railroad completed, in 1909, marketed itself as “the Modern Road to the Ancient East."

Trans-Pacific freight still rides these rails, often in shipping containers, the standardized metal boxes that carry most of the world’s commerce. The Port of Los Angeles, for example, is the Western Hemisphere’s busiest container port and China is its most valuable trading partner. In 2019, the Port of L.A. moved $128 billion worth of cargo to or from China, worth more than its trade with the next four countries on the list — combined. Freight trains funnel American products into Los Angeles for export; the same trains fan out across the country distributing containers loaded with Asian imports. The long history of U.S. engagement with China remains etched into the nation’s landscape, in the shape and form of the American railway network.

Nineteenth-century Americans seized on the railroad as a new technology to build a more interconnected global economy. Despite the racist and nativist ideas held by many White Americans at the time, they recognized investing in global trade would ultimately bring the United States economic and political power. China has clearly absorbed this lesson: Today, its Belt and Road Initiative funds construction of transportation infrastructure in other countries to benefit its own economy. While an earlier generation of American politicians and entrepreneurs built rails reaching out toward the Pacific Ocean and China beyond, the Trump administration repeatedly tries to build walls.