Networking giant Cisco (CSCO 0.44%) recently agreed to form a joint venture with Chinese server maker Inspur to sell networking and cloud computing products in China. The companies announced that they would invest $100 million in the project, but neither revealed any specific details.

Cisco's routers. Source: Cisco.

The partnership is a clear attempt to boost Cisco's presence in China, where sales have tumbled due to competition from cheaper Chinese rivals like Huawei, exacerbated by cybersecurity concerns about American tech companies. Let's take a closer look at Cisco's rocky relationship with China, and the difficulties other U.S. tech companies face in the country.

Cisco and China
Once upon a time, Cisco helped build the Great Firewall of China. That project was harshly criticized, but helped the company gain a lot of credibility in China. But over the past decade, increased suspicions of cyberspying and the Snowden leaks caused American tech firms, including Cisco, to fall out of favor.

The Chinese government now plans to remove all foreign technologies from banks, the military, state-owned enterprises, and government agencies by 2020, according to Bloomberg. This means that instead of using American CPUs, operating systems, networking equipment, and servers, all "high security" enterprises could be required to use homegrown tech.

To curry the government's favor during this critical shift, Cisco recently agreed to invest over $10 billion through China's National Development and Reform Commission over the next few years to improve tech training in colleges, create jobs, fund R&D efforts, and attract equity investments. The joint venture with Inspur is related to this broad push.

In fiscal 2015, revenue from Cisco's APJC (Asia-Pacific, Japan, and China) region slipped 2% annually to $7.2 billion and accounted for 15% of its top line. Revenue in China declined 21% annually, offsetting moderate gains in other countries. Unless Cisco can win the favor of the Chinese government while fending off cheaper Chinese rivals, those losses will keep weighing down its APJC sales.

Partnerships are the preferred option
China generally favors joint ventures with Chinese companies over stand-alone expansions into the country. That means that U.S. companies must share their profits with Chinese companies, but they also gain local expertise and significant tax benefits if the goods are manufactured within China.

Kylin. Source: Company website.

Back in March, IBM (IBM 0.06%) agreed to license designs for its semiconductor chips, servers, and software to several Chinese tech companies, including Inspur.

Microsoft (MSFT -1.27%) recently announced a partnership with Baidu (BIDU -0.56%) and state-owned private investment firm Tsinghua Unigroup to develop cloud technologies. That three-way partnership was struck ahead of the upcoming launch of Ubuntu Kylin, a Chinese-developed Linux OS designed to replace Windows on government computers. Dell, which recently promised to invest $125 billion in China over the next five years, will install Kylin on 40% of its PCs sold in China.

These partnerships could help those companies avoid the fate of Qualcomm (QCOM -2.36%), which was hit by a $975 million antitrust fine last year.

Caught in the political crossfire
American critics have accused China of kneecapping U.S. companies to protect its own businesses. China claims that the U.S. did the same thing to companies like Huawei when they tried to enter the United States.

American tech companies have tried to distance themselves from the U.S. government to avoid being caught in the political crossfire. Earlier this year, Silicon Valley's biggest companies signed an open letter to the Obama Administration, urging it to stop pushing tech companies to lower encryption standards or create "backdoors" for law enforcement agencies. That move would further reinforce the damaging notion, both at home and abroad, that U.S. tech companies have become extensions of the NSA.

This puts companies like Cisco in an awkward position. Cisco would certainly like to see its Chinese sales grow again, but it's unclear if all its compromises and investments will stop major Chinese customers from buying Huawei routers and switches instead. Cisco also must distance itself from the U.S. government without being vilified as the kowtowing company that built the Great Firewall of China. It will be a tough balancing act to pull off, especially as cyber security tensions escalate between the two countries.