California is trapped—caught in the dangerous space between two menacingly authoritarian regimes that want to fight each other.

One regime is headquartered in Beijing, and the other is about to take power in Washington D.C. But when viewed from the Golden State, it’s striking how much they have in common.

Both are fervently nationalist, full of military men, and so bellicose they are spooking neighbors and allies. Both, while nodding to public opinion, express open contempt for human rights and undermine faith in elections and the free press. Both promote hatred of minorities (anti-Tibetan and anti-Uighur stances in China; anti-Mexican and anti-Muslim stances in the U.S.).

And both regimes are captained by swaggering men (President Xi Jinping in China; President-elect Donald Trump in U.S.) who tend to their own cults of personality and pose as corruption fighters while using their power to enrich their own families.

Most frighteningly for Californians, both regimes seem to see advantage in escalating conflict with the other. Both leaders have encouraged hatred of the other’s citizens (Xi has embraced ultranationalists who compare American treatment of the Chinese to Hitler’s treatment of the Jews, while Trump has called China a “deceitful culture”). The incoming American administration is threatening to raise tariffs and label China a currency manipulator, actions that would likely start a trade war. The Chinese administration is provoking confrontations in the South China Sea while the new American strongman embraces Taiwan—actions that could start a real war.

All this leaves California with the enormous challenge of navigating U.S.-China tensions in a way that protects our people, our economy and our values. And that will require tricky diplomacy that doesn’t take sides, for we need to maintain relations with both regimes. After all, we live under the laws of the United States, but are irretrievably linked to China, a vital partner in the trade, culture, technology and education sectors that distinguish California in the world.

A sustained conflict between China and the U.S. could produce all kinds of new restrictions on the flow of money and people, with devastating results for California. Our public universities rely both on federal funds from D.C. and top-dollar, out-of-state tuition fees from Chinese students to subsidize the education of Californians. So any Trump restrictions on foreign visitors—or retaliatory Chinese limits on overseas study and travel—could blow up the University of California’s business model. It also would damage the University of Southern California, the city of L.A.’s largest private sector employer, which heavily recruits Chinese students.

Our state’s signature industries—Silicon Valley and Hollywood—depend on consumers who live under both regimes. And our most promising ventures—from virtual reality and artificial intelligence technologies to major developments (like the San Francisco Shipyards in Hunter’s Point, to just name one)—rely on our ability to bring together manufacturers, investors and technologists from China and the U.S. In a trade war, both regimes could decimate innovation and development with restrictions on foreign investments.

And with both regimes so quick to escalate nationalist rhetoric, it’s quite possible that both Chinese nationals and Chinese Americans in California could become targets of bigotry and hate crimes. Our housing market relies on Chinese buyers, who spend an estimated $9 billion a year on homes here. A backlash against Chinese investors buying homes (and using them only part of the year) could produce discrimination and hurt our housing market, which in turn would damage the already underfunded public schools our taxes support.

How then can California handle such a conflict?

First, by protecting our people (especially Californians of Chinese ancestry) and our institutional connections to China with the same fervor the California government is rallying to protect our undocumented immigrants against Trump’s threats of mass deportations. This California diplomacy will be especially hard given the hyper-sensitivity of the autocrats in Beijing and D.C. to the slightest of slights; just as Trump lashes out at Saturday Night Live parodies, Xi and his loyalists see the Kung Fu Panda films as American warfare against them.

And, second, by reminding both regimes—in friendly but firm ways—that we are opposed to conflict because the U.S. and China need each other more than they appear willing to acknowledge.

Californians who doubt this would do well to consult John Pomfret’s masterful new book, The Beautiful Country and the Middle Kingdom: America and China, 1776 to the Present. Pomfret, an American journalist long posted in China, employs telling details (the tea thrown into Boston Harbor was from Xiamen; an 1860s California attorney general campaigned against Chinese prostitutes while importing his own) to show how profoundly the two countries have shaped one other’s development, and just how vital their relationship has become to the world.

“The two nations have feuded fiercely and frequently, yet, irresistibly and inevitably, they are drawn back to one another,” he writes. “The result is two powers locked in an entangling embrace that neither can quit.”

California’s role in this difficult period should be to tell the story of its own deep ties to China, while serving as a model for a productive relationship, argues Matt Sheehan, author of the forthcoming book Chinafornia: Working with Chinese Investors, Immigrants and Ideas on U.S. Soil.

Sheehan, who also publishes the weekly Chinafornia Newsletter and provides communications consulting for Chinese and U.S. companies, says now is an important time for California officials and businesses to seek out areas of productive cooperation with Chinese counterparts, especially in areas like manufacturing and fighting climate change.

“I think of California as a living laboratory for a more practical, productive version of U.S.-China relations,” he says.

But not all collaborations with China would be helpful. Our technologies companies shouldn’t be aiding the U.S. surveillance state or assisting the Chinese government in suppressing human rights, as Facebook is reportedly doing by developing a newsfeed that would empower censors.

We also shouldn’t play to anti-Chinese prejudice, like some California unions have done in opposing trade agreements and advancing union organizing. One noxious—if ridiculous—example is a current push by the hotel workers’ union to block the sale of the Westin Hotel in Long Beach (where the union has an organizing campaign) to Chinese interests on grounds that it’s so close to that city’s port that Chinese ownership would threaten national security.

One possible model for California’s strategy going forward might be Anson Burlingame, whom President Lincoln dispatched to Beijing to represent the U.S. during the Civil War. Burlingame’s approach, as described by Pomfret, was to commiserate with the Chinese (we have our terrible rebellion with the South, you with the Taipings) as a basis for collaboration. His work ultimately produced the Burlingame Treaty, which banned discrimination against Chinese workers in America, welcomed Chinese students to U.S. educational institutions, and opened the way for Chinese immigrants to become American citizens.

Today, Burlingame’s accomplishments are mostly forgotten, but his name belongs to a highly desirable suburb in the San Francisco Bay Area, a region boasting one of America’s most prosperous populations of Chinese Americans.

Joe Mathews writes the Connecting California column for Zócalo Public Square.