SHANGHAI - Chinese President Xi Jinping issued a veiled warning to the United States on Wednesday, saying countries should not build up military alliances in Asia, even as Beijing feuds with several neighbours.Speaking at an Asian regional security forum in Shanghai, Xi said a rising China would seek "peaceful" means to resolve territorial disputes.Beijing has sought to counter Washington's foreign policy "pivot" to Asia, but it has also irritated Vietnam, Japan and the Philippines - the latter two US allies - with what those countries say are aggressive moves in separate maritime rows."To beef up an entrenched or military alliance targeted at a third party is not conducive to maintaining common security," Xi said, without naming names.Washington's traditional allies in the Asia-Pacific region include Japan, where it has military bases and whose security it guarantees by treaty, and Australia.China's official Xinhua news agency on Tuesday urged countries from outside Asia not to raise tensions. "Players from other parts of the world need to play a constructive role. They should refrain from starting fires and stoking flames," it said in an editorial.The relationship between Beijing and Washington has been strained in recent days after a US grand jury indicted five Chinese military officers on charges they hacked American computers to benefit Chinese state firms.A state-owned Chinese newspaper took direct aim at the United States on the issue Wednesday, calling it a "mincing rascal" for playing the cyber-espionage victim. Xi said: "China stays committed to seeking peaceful settlement of disputes with other countries over territorial sovereignty, and maritime rights and interests." Xi was speaking at the Conference on Interaction and Confidence Building Measures in Asia (CICA), a relatively obscure forum which China is seeking to build up in importance.But Chinese organisers allowed media coverage of only Xi's address and a statement by the Turkish delegate before cutting off a live feed of speeches in the summit hall. Vietnam belongs to the forum but Japan is only an observer, while the Philippines is not a member. The United States has observer status, preferring to work through the Asia-Pacific Economic Cooperation (APEC) forum.Xi, who became president last year, has overseen a foreign policy which has sought to assert China's interests in both continental Asia and the Pacific Ocean.On Tuesday, he and his Russian counterpart Vladimir Putin launched naval exercises off Shanghai, and on Wednesday they oversaw the signing of a huge and long-awaited gas deal between their two countries. Under the 30-year contract between China's CNPC and Russia's Gazprom - reportedly worth as much as $400 billion - 38 billion cubic metres of gas could eventually be sent annually from Russia to energy-hungry China.Xi told the forum that Beijing was interested in a regional security code, but gave no details.Several countries have overlapping claims in the South China Sea, which is home to key shipping lanes and thought to contain vast energy reserves.Earlier this month, Southeast Asian leaders expressed "serious concern" over worsening territorial disputes in the area, calling for a peaceful resolution and presenting a rare united front against Beijing.Later Wednesday Vietnamese Prime Minister Ngyuen Tan Dung said after a meeting with Philippine President Benigno Aquino in Manila that China's dispatch of the oil rig had "seriously threatened peace".Before the start of the forum, Xi shook hands with other state leaders attending, including Putin, Hassan Rouhani of Iran and Afghanistan's Hamid Karzai.But the live broadcast appeared to cut away when Vietnamese Vice President Nguyen Thi Doan shook hands with Xi.The move by China's heavily-censored state television drew some laughter from Chinese journalists in the media centre, with one saying: "You can't see that."