In this May 7, 2012 photo released by China's Xinhua News Agency, Haiyang Shiyou oil rig 981, the first deep-water drilling rig developed in China, is pictured 200 miles southeast of Hong Kong in the South China Sea. On Wednesday, July 16, 2014, China moved an oil rig that it had deployed in a section of the South China Sea. Beijing deployed the massive rig in early May close to the Paracel Islands, triggering a furious reaction in Hanoi . (Jin Liangkuai/AP)

China said it was towing away a giant oil rig from waters disputed with Vietnam on Wednesday, ahead of the onset of the typhoon season and after finding signs of oil and gas, but insisted it stood firm on maritime claims that have sparked a bitter dispute between the neighboring countries — and warned it could be back.

China deployed the $1 billion rig in early May in waters close to the Paracel Islands in the South China Sea, in waters Vietnam considers to be within its 200-nautical-mile exclusive economic zone. That move sparked deadly riots in Vietnam, and a tense standoff in the waters themselves, with Vietnamese and Chinese ships ramming each other on a regular basis, and one Vietnamese fishing boat sunk in May.

China occupies the disputed Paracel Islands, and says it has “historical claims” to around 90 percent of the South China Sea, including waters much closer to other nations, but has refused to submit those claims to international arbitration.

China’s assertion of its maritime claims in the South and East China Seas has provoked a significant deterioration in relations with the United States, which counts many of the rival claimants to the waters as allies and friends.

Washington had called the deployment of the rig a “provocative” move, and has been calling for all countries to observe a freeze on building works and other actions on disputed islands and reefs in the South China Sea. But China has categorically rejected that suggestion, warning the United States to stay out of the dispute and stop “taking sides.”

The rig had originally been expected to remain in place until mid-August, but authorities said it had been withdrawn after completing its operations and ahead of the typhoon season. Vietnam’s coastguard told the Reuters news agency the rig was being towed towards the Chinese island of Hainan on Wednesday.

China National Petroleum Corporation, the main state oil and gas company, said the rig had found signs of oil and gas, but needed to evaluate geological data further before further “extraction testing” could take place. If the rig does indeed return and begin drilling, that could become a source of tension between the two nations for years to come.

A Pew Research survey of public opinion released this week found that 84 percent of Vietnamese people were concerned or somewhat concerned that China’s territorial disputes with its neighboring countries could lead to military conflict, while 62 percent of Chinese people held the same view.

On social media, Chinese netizens reacted to the decision to withdraw the rig with dismay, suggesting it was made under U.S. pressure. One called the decision “shameful,” while another labelled China’s foreign ministry “jellyfish.”

“How about moving Obama’s office to China?” suggested one user ironically. “It would be more convenient for accepting his suggestions.”

On Tuesday, China’s Foreign Ministry spokesman Hong Lei said China did not accept a U.S. proposal, conveyed in public as well as behind closed doors at last week’s U.S.-China Strategic and Economic Dialogue , that countries in the region freeze any activities in Asia’s disputed waters aimed at altering the status quo.

Hong said China’s neighbors had been strengthening their “illegal presence through construction and increased arms build-up” since the 1970s, and effectively told the United States to mind its own business.

“(We) hope that countries outside the region strictly maintain neutrality, clearly distinguish right from wrong, and substantially respect the concerted efforts of the countries in the region to safeguard regional peace and stability,” he said, according to the official Xinhua news agency.

Xu Jing contributed to this report.