HANOI (Reuters) - Hundreds rallied on Sunday in Vietnam’s biggest cities to denounce China’s setting up of a giant oil rig in the South China Sea, a rare protest likely to prolong a tense standoff between the two communist neighbors.

Protester Truong Van Dung (C) holds a photo of captain Nguy Van Tha who was killed in the January 1974 Battle of the Paracel Islands, during an anti-China protest in front of the Opera House in Hanoi May 11, 2014. REUTERS/Kham

At least 300 people massed in front of China’s embassy in Hanoi and a few hundred more at its consulate in Ho Chi Minh City, witnesses said, chanting “Down with China” in protests that expose the underlying cracks in relations between the two political and economic allies.

China’s parking of the rig in contested waters a week ago was one of its most provocative moves in years and followed U.S. President Barack Obama’s visit to allies such as Japan and the Philippines, which are among the countries locked in disputes at sea with an increasingly assertive Beijing.

Sunday’s demonstrations were small but highly significant. Protests are rare in Vietnam and often thwarted by the authorities in what analysts say are attempts to contain domestic dissent as discontent brews over land grabs, graft, the economy and relations with China.

Police, known for rounding up and detaining protesters, allowed them to breach a security cordon in Hanoi and gather in front of China’s embassy, where some held placards reading “China - hands off Vietnam”, or bearing slogans telling state-run CNOOC to remove the rig.

“We’re very angry. We came here today to show we students are ready to side with the government,” said Hoang Thi Nhat, a 21-year-old who attends university in Hanoi.

“When requested, we’ll do everything within our abilities to protect our nation’s sovereignty.”

Slideshow ( 4 images )

Vietnam state media estimates of crowd size ranged from thousands of people to tens of thousands and even hundreds of thousands. Websites of newspapers said rallies were also held in the central cities of Hue and Danang.

HISTORY OF DISPUTES

China and Vietnam have a long history of battles, the most recent a brief war in 1979 and sea skirmishes during the 1970s and 1980s, when Vietnam bore the brunt of the casualties.

Sovereignty disputes and perceived Chinese bullying have put Vietnam in a tricky spot, pressed to respond but wary of pushing too far and risk alienating a neighbour with which it had bilateral trade of more than $50 billion last year.

Still, Vietnam has responded strongly this time, with veiled threats of international litigation and vows to respond militarily to Chinese aggression. Vietnam says the rig is flanked by about 80 Chinese ships, some navy, while each side has accused the other of ramming rival vessels.

“Our country has been through years of war to defend against invasion,” said protester Nguyen Quang Thang, 60. “We want peaceful days like today, to live in stability and to move forward, but China keeps dragging us into war.”

The United States, which has been offering Vietnam trade and military incentives in a bid to broaden its footprint in the region, described China’s actions as “provocative and unhelpful”.

China says the rig was in its territory and blamed Washington for encouraging “certain countries” to act dangerously and provocatively.

The issue had threatened to overshadow the weekend’s summit of the Association of Southeast Asian Nations (ASEAN), four of whose 10 members have competing sovereignty claims with China, the grouping’s major trade partner, in waters believed to be rich in untapped energy reserves.

ASEAN foreign ministers in Myanmar’s capital Naypyitaw issued a statement on Saturday expressing “serious concerns” and the need for a restraint and peaceful resolution to “ongoing developments”, without referring to China specifically.

China’s foreign ministry on Sunday said it opposed certain countries exploiting the issue to damage its ties with ASEAN. [ID:nL3N0NX044]