HONG KONG (AP) -- The high-profile attendance of the leaders of Apple and Google at a Chinese conference promoting Beijing's vision of a censored internet highlights the dilemma for Western tech companies trying to expand in an increasingly lucrative but restricted market.

The event in Wuzhen, a historic canal town outside Shanghai, marked the first time chiefs of two of the world's biggest tech companies have attended the annual state-run World Internet Conference.

Apple CEO Tim Cook told the gathering as the conference opened Sunday that his company was proud to work with Chinese partners to build a "common future in cyberspace."

His and Google CEO Sundar Pichai's presence along with other business leaders, diplomats and other experts, some analysts say, helped bestow credibility on Beijing's preferred version of an internet sharply at odds with Silicon Valley's dedication to unfettered access.

Chinese President Xi Jinping vowed, in remarks to the conference conveyed by an official, that "China's door to the world will never close, but will only open wider."

As in previous years, organizers allowed attendees unrestricted access to the internet, contrary to official policy under which internet users face extensive monitoring and censorship and are blocked from accessing many overseas sites by the so-called Great Firewall of China.

Since Xi came to power in 2013, he has tightened controls and further stifled free expression, activists say.

Beijing's restraints also extend to Western companies like Google, Twitter and Facebook, which have largely been shut out from the market, leaving it to homegrown internet giants like Tencent.

Apple has a large production base in China, which is one of its biggest markets, though domestic smartphone makers are catching up.

It has been criticized by some app developers for complying with Chinese censorship demands. In July, companies that let people get around the government's internet filters - known as virtual private network providers - said their programs had been removed from Apple's app store in China. One such company, ExpressVPN, said Apple was "aiding China's censorship effort."

Apple said that China began requiring this year that developers of virtual-private networks have a government license. The California-based tech giant said it had removed apps "in China that do not meet the new regulations." Two Apple spokeswomen couldn't be reached by phone for comment.

"The problem is that these companies are between a rock and a hard place," said Rogier Creemers, a China researcher at Leiden University who attended the conference. They covet China's huge market but if they do make it in, as in Apple's case, local law "requires things that Western observers generally are uncomfortable with," he said.

Cook's speech drew a big crowd. He said the company supports more than 5 million jobs in China, including 1.8 million software developers who have earned more than 112 billion yuan ($17 billion).

It's Apple's responsibility to ensure that "technology is infused with humanity," he said, avoiding mention of any sensitive topics.

Google shut the Chinese version of its search engine in 2010 over censorship concerns. Pichai has talked about wanting to re-enter China, and he told a panel discussion in Wuzhen that small and mid-sized Chinese businesses use Google services to get their products to other countries, according to a report in the South China Morning Post. A Google spokesman declined to comment.

The tech giants may have chosen to appear at the conference because the current political climate in the United States encourages a pragmatic approach in pursuing business regardless of other concerns, said Jonathan Sullivan, director of the University of Nottingham's China Policy Institute.

"There has never been a time when an American company is less likely to be called out by the White House for pursuing a business-first approach," said Sullivan.