China defended its right to censor the Internet on Thursday, saying it was necessary to safeguard the public after the United States pressed China to explain online curbs on U.S. companies.

The United States wants to know why the so-called Great Firewall of China blocks so many U.S. companies from providing services via the Internet, according to a letter obtained on Wednesday, another sign of growing trade tension between the world's two largest economies.

Foreign Ministry spokeswoman Jiang Yu said China had actively encouraged the development of the Internet and protected freedom of speech online.

At the same time, in terms of China's lawful Internet management, its purpose is to maintain a good Internet environment and to safeguard public interest, Jiang told reporters. These are in line with internationally accepted practices.

We are willing to work with countries and communicate with them on the development of the Internet and to work together to promote the sound development of the Internet, she said. But we do not accept using the excuse of 'Internet freedom' to interfere in other countries' internal practices.

She added that foreign companies were welcome to do business in the country.

The U.S. Ambassador to the World Trade Organization, Michael Punke, said in a letter to his Chinese counterpart on Monday that some companies based outside China had faced challenges offering their services to Chinese customers when their websites were blocked by China's national firewall.

The latest dispute could bring Internet policy back to the foreground of U.S.-China relations, reprising tension from last year when the Obama administration took up Google's complaints about hacking and censorship from China.

Google partly pulled out of China after that dispute.

China, with more than 450 million Internet users, exercises tight control and censorship over the Web at home, and has strengthened its grip in recent months.

China bans numerous websites, including Facebook, Twitter and YouTube and some foreign media outlets, fearing the uncensored sharing of images and information could cause social instability and harm national security.

The Great Firewall of China can also cause blockage or slow loading of websites not subject to the ban, and is the source of widespread frustration to users in China.

(Reporting by Sui-Lee Wee and Sabrina Mao; Editing by Nick Macfie)