Apple Inc. has come out swinging in its pitched battle with the government on its home turf.

But when it comes to its second-largest market, China, the Cupertino, Calif., company has been far more accommodating.

Since the iPhone was officially introduced in China seven years ago, Apple has overcome a national security backlash there and has censored apps that wouldn't pass muster with Chinese authorities. It has moved local user data onto servers operated by the state-owned China Telecom and submits to security audits by Chinese authorities.

The approach contrasts with Apple's defiant stance against the FBI, which is heaping pressure on the company to decrypt an iPhone that belonged to San Bernardino shooter Syed Rizwan Farook.

I can't imagine the Chinese would tolerate end-to-end encryption or a refusal to cooperate with their police, particularly in a terrorism case.— James Lewis, senior fellow, Center for Strategic and International Studies

The years-long strategy in China is paying off at a crucial time. While sales of Apple products have flatlined or declined in the U.S., Europe and Japan, business in the company's greater China region continues to soar — to a record $59 billion last year. The Asian giant surpassed the U.S. last year as the No. 1 buyer of iPhones and could one day be the largest market for Apple Pay, the mobile payment platform that was rolled out for Chinese consumers last week.

But there's no guarantee the good times will continue rolling for Apple. Beijing is increasingly tightening the screws on foreign technology companies, having introduced strict laws aimed at policing the Internet and digital hardware.

The environment will get even tougher, Apple says, if the FBI prevails in seeking a so-called backdoor to Farook's phone. That could set a precedent for China's authoritarian leaders to demand the same in a country where Apple has never publicly defied orders.

"What's driving this is Apple's desire to persuade the global market, and particularly the China market, that the FBI can't just stroll in and ask for data," said James Lewis, senior fellow at the Center for Strategic and International Studies in Washington. "I can't imagine the Chinese would tolerate end-to-end encryption or a refusal to cooperate with their police, particularly in a terrorism case."

The last time Apple was in the crosshairs of Chinese negative opinion was after the Edward Snowden National Security Agency leak in late 2013.

Chinese state-run media began raising national security questions about the iPhone's location-tracking feature. Communist party cadres and other officials were also urged to ditch their Apple devices.

The controversy underscored how quickly nationalistic sentiment in China can turn on a foreign brand.

Amid the furor, Apple announced it was shifting local user data onto China-based servers.

The move was seen by some analysts as a concession to calm fears that Apple's infrastructure was compromised by U.S. intelligence. It came four years after Google pulled its search engine out of China in an unprecedented stand against the Chinese government over censorship.

Apple, one of only a handful of U.S. tech giants that have flourished in China, said the move was necessary to improve services for its growing Chinese user base. It added that all data on the servers were encrypted and inaccessible to China Telecom.

"Whatever data is on Chinese servers is susceptible to confiscation or even cryptanalysis," a sort of code cracking, said Jonathan Zdziarski, a leading expert in iPhone security.

The same could be said about access to data in servers in the U.S., Zdziarski said, the only difference being you need a subpoena.

But it's not just the servers that pose a risk. Apple's source codes could be stolen from one of its Chinese factories or during government security audits.

"Most of the hardware tools that have hacked iPhones in the past all came out of China, and that's probably for a reason," Zdziarski said. "It'd be foolish to think that Apple could form a safe and healthy relationship with the Chinese government that didn't put the U.S. at some level of higher risk."

In the end, moving users to China Telecom's servers was followed by a rehabilitation of Apple's image in China that continues today.

On Monday, the state-run Economic Daily gave Apple Pay its stamp of approval, saying it complied with national security standards — echoing endorsements the iPhone 6 received more than a year earlier.

In January 2015, the government mouthpiece, the People's Daily, tweeted a picture of Apple Chief Executive Tim Cook shaking hands with Lu Wei, China's top cyberspace official.

"Apple has agreed to China's security checks, 1st foreign firm to agree to rules of Cyberspace Admin of China," the tweet said.

Apple said this was nothing special; it accedes to security checks in all countries it operates in. And all companies that want to do business with China are required to submit to such checks.

What's different, however, is how stringent the checks could be in the near future.

Despite criticism from foreign governments, including the White House, China is introducing security laws that are so vaguely worded some fear it will require technology companies to provide source codes and backdoors for market access. Regulators there have already demanded more foreign companies store data locally like Apple did with China Telecom.

How the new rules fare could depend on the outcome of Apple's case with the FBI, experts say.

"The problem is, depending on what happens with Apple in the U.S., the window for foreign companies to maneuver over encryption and other security requirements in China could shrink," said Samm Sacks, an analyst for Eurasia Group.

She said the ambiguity of China's security laws are designed to promote self-censorship.

Apple in the past has pulled apps from its China app store that mentioned the Dalai Lama and ethnic Uighur activist Rebiya Kadeer — both considered enemies of the state. And late last year, it disabled its news app in China.

"Virtually every foreign tech company doing business in China is going to have to make some concessions to the government, just as the price of entry," said Charlie Custer, a writer and expert on tech in China.

"I'd love to hold all global corporations to Google's moral standard, but it's probably not realistic to expect that, especially from a company like Apple whose most important market is probably China."

A version of this article appeared in print on February 26, 2016, in the Business section of the Los Angeles Times with the headline "As it defies U.S., Apple complies with China - Firm reaps big rewards from toeing the line, but that may change if it loses fight with FBI." —
Today's paperToday's paper | Subscribe