Vietnam's prime minister said Thursday for the first time that his country was considering legal action against China over its sovereignty claims in the South China Sea, a move that Beijing would likely fiercely oppose.

China claims nearly all of the South China Sea as its own, bringing it into conflict with the far smaller nations of Vietnam, the Philippines and three others that have rival claims. Beijing also has a territorial dispute with Japan over a cluster of islands in the East China Sea.

Last year, the Philippines filed a complaint against China before an international tribunal in The Hague to challenge the legality of its claims, antagonizing China. Beijing wants any disputes with countries to be resolved bilaterally even as it continues to engage in what many in the region regard as provocative assertions of its sovereignty in the waters.

China raised the stakes in the region earlier this month when it deployed an oil rig to patch of the sea claimed by Hanoi, triggering fury in Hanoi, which sent ships to try and disrupt the drilling operation. Vietnam had been trying to a more low-key approach in its dealings with China, but the oil rig deployment may have changed that thinking.

In a written reply to questions sent by The Associated Press, Prime Minister Nguyen Tan Dung "like all countries, Vietnam is considering various defense options, including legal actions in accordance with the international law," said Dung who did not specify what legal action Hanoi was considering.

Two Vietnamese diplomats have previously told The AP that Vietnam might now file its own appeal or join Manila's legal challenge against China. A senior Philippine government official told The AP that Dung and other Vietnamese officials mentioned that plan to their Philippine counterparts in closed-door meetings on Wednesday. None gave their name because they were not authorized to speak to the media.

Dung has demanded China withdraw the rig, but Beijing insists it has done nothing wrong.

When asked if his country would risk going to war in disputed waters, Dung said his country would never venture into that.

"Military solution? The answer is No," Dung said in the email. "Vietnam has endured untold suffering and losses from past invasive wars ... We are never the first to use military means and would never unilaterally start a military confrontation unless we are forced to take self-defense actions."

On Wednesday, Dung said he and Philippine President Benigno Aquino III "shared deep concern over the current extremely dangerous situation caused by China's many actions that violate international law."

And in a rare show of public unity between two states wrestling with China's growing assertiveness, Dung said Vietnam and the Philippines were "determined to oppose China's violations and call on countries and the international community to continue strongly condemning China and demanding China to immediately end the above said violations."

Aquino, standing beside Dung, did not mention the territorial disputes with China when he and Dung faced journalists but said they discussed how their countries could enhance defense and economic ties, adding that both governments aim to double two-way trade to $3 billion in two years.

"In defense and security, we discussed how we can enhance confidence-building, our defense capabilities and inter-operability in addressing security challenges," Aquino said.

The Philippines, a U.S. treaty ally, has been more vocal in opposing China than Vietnam, which has been trying to quietly resolve its territorial dispute with Beijing. But Hanoi was incensed by the deployment of the oil rig on May 1, leading to speculation it would shift its approach.

Many have feared that long-seething territorial disputes in the resource-rich South China Sea could spark Asia's next major armed conflict. Brunei, Malaysia and Taiwan also have overlapping territorial claims in the strategic area.

China and the Philippines are in a standoff over another South China Sea reef, the Second Thomas Shoal. Chinese coast guard ships have three times attempted to block Filipino vessels delivering new military personnel and food supplies to Philippine marines keeping watch on the disputed area on board a long-grounded ship.

Chinese maritime surveillance ships took effective control of Scarborough Shoal off the northwestern Philippines after Filipino government vessels withdrew from the disputed fishing ground two years ago. Alarmed by China's move, the Philippines challenged the legality of Beijing's vast territorial claims in the South China Sea before an international arbitration tribunal last year.

The Philippines took the legal step after exhausting other peaceful means to resolve its territorial disputes with China, Foreign Secretary Albert del Rosario said. He suggested Vietnam make an assessment as to whether resorting to legal means would promote its national interests, he said.


Associated Press writer Teresa Cerojano contributed to this report.