Hong Kong (CNN) -- When China's state-owned oil company dispatched an oil rig to a contested area of the South China Sea it flicked a match on a long-smoldering dispute with its communist neighbor Vietnam.
Analysts say Beijing must have known the move would elicit some reaction, but it clearly didn't predict having to evacuate thousands of Chinese nationals desperate to put some distance between them and violent Vietnamese protests.
"The whole episode seems to reek of miscalculation, perhaps by both sides, but it demonstrates how volatile how this region can be," said Alexander Neill, Shangri-La Dialogue Senior Fellow at the International Institute for Strategic Studies, Asia (IISS).
At issue is the positioning of an oil rig in waters claimed by both China and Vietnam. Vietnam claims the rig's presence is "illegal" while China says it has every right to drill, and has castigated the Vietnamese government for failing to ensure the safety of its nationals.
To understand the issue, it's vital to look at the exact position of the rig.
Where is the rig?
In early May, Beijing announced the HD-981 rig would be parked at sea for exploratory work until mid-August. Owned by the China National Offshore Oil Corporation (CNOOC), the rig is anchored in Lot 143, about 120 nautical miles east of Vietnam's Ly Son Island and 180 nautical miles from China's Hainan Island, according to the Center for Strategic and International Studies (CSIS).
Analysis co-authored by CSIS experts said China's Ministry of Foreign Affairs appears to be basing its right to be there on the assumption that one of the Paracel Islands, which it claims as its own, is 17 miles north, allowing it to claim its own continental shelf in the region.
China calls the contested Paracel Islands the Xisha Islands, while in Vietnam they're known as the Hoang Sa Islands.
Vietnam says the rig site is clearly on its continental shelf, and moreover is in its Exclusive Economic Zone. Hanoi has demanded that China remove the offending rig, escort vessels from the region and hold talks to settle the issue.
The Chinese rig was escorted to the region by naval vessels and fighter jets, drawing Vietnamese boats to the area and raising tensions at sea. The Vietnamese have accused Chinese vessels of ramming and blasting its boats with water cannon. The Chinese say any conflict was provoked by Vietnamese harassment.
Clashes on land
Miles away from the standoff at sea, violent protests have erupted at Chinese and Taiwanese owned or operated factories, mainly in the provinces of Ha Tinh and Binh Duoung.
Protesters smashed down gates and set fire to businesses, attacking anything deemed to be of Chinese origin, including its nationals.
On Sunday, China chartered flights to evacuate 290 citizens, including 100 injured in the most recent violence.
Video aired by state broadcaster CCTV showed some limping or being carried down the stairs of a medical flight arriving in the city of Chengdu, many with limbs bandaged. Two Chinese nationals were killed in earlier clashes, authorities said.
Around 7,000 Chinese nationals had boarded ships or were due to do so this week, state news agency Xinhua reported. An outraged opinion piece published on the same site said the protests by "irrational rioters" would in no way strengthen Hanoi's "groundless claim over Chinese territory and surrounding waters in the South China Sea."
Who is right?
While many commentators say Vietnam has every right to feel appalled over the positioning of the Chinese rig, at least one analyst says the issue not as clear cut as some suggest.
"Geographical proximity alone is not an unequivocal basis for claiming sovereignty or sovereign rights," writes Sam Bateman in the Eurasia Review.
Bateman, a senior fellow at the S. Rajaratnam School of International Studies (RSIS) at Nanyang Technological University, says Vietnam's claim to the Paracel Islands is "seriously weakened" by North Vietnam's recognition of China's sovereignty over the Paracels and lack of protest between 1958 and 1975.
In 1974, the two countries fought the Battle of the Paracel Islands, which ended in a Chinese victory and complete control over the land and surrounding waters.
After the reunification of Vietnam in 1975, Vietnam's leaders publicly renewed the country's claim to the islands but the issue remains unresolved. In January this year, activists shouted anti-China slogans and laid flowers for more than 70 Vietnamese soldiers killed in the conflict, 40 years on.
What is motivating China?
On the surface, oil would seem to be the reason China has waded into the disputed area but analysts say politics are clearly at play.
"This kind of a move by putting an oil rig in this sort of place, you could say it's a carte blanche to allow China to enhance its naval operations in the region and to project its power further out into the South China Sea," Neill said.
It's not the first time China has stepped on regional sensitivities by making high profile and deliberate incursions into contested tracts. There have been tense encounters between Japan and China over the Senkaku or Diaoyu Islands in recent years, and China has locked horns with the Philippines over competing claims to the Scarborough Shoal.
In a statement released May 7, the U.S. State Department characterized China's latest move as a "part of a broader pattern of Chinese behavior to advance its claims over disputed territory in a manner that undermines peace and stability in the region."
What's the response from China?
The ferocity of the Vietnamese protests appears to have taken China by surprise and it's clearly expressed its dissatisfaction with Vietnam's handling of the unrest.
On May 18, China announced it was suspending some of its plans for bilateral exchanges with the country. It's warned its citizens that Vietnam is not safe for travel, while the Global Times reported many Chinese travel agencies had suspended tours to Vietnam.
China has also warned of other unspecified punishment, hinting that it will use its economic leverage. Trade between China and Vietnam reached more than 50 billion dollars in 2013 according to Chinese state media and Vietnam depends heavily on foreign investment.
Commentary carried by China's state-run Xinhua news agency suggested: "It is advisable for the Vietnamese government to think of the bigger picture and not to get stuck in extreme nationalism so as to avoid escalation of violence and complication of the situation in the South China Sea.
"By immediately stopping the violence and any further provocations, Vietnam can work with China to tap the full potential of their economic cooperation in such areas as financial services and industry transfer."
How has Vietnam responded?
While maintaining its demands for China to leave the contested area, the Vietnamese government says it's taken steps to dampen further protests. It has characterized the protests as "spontaneous acts" by individuals who are exploiting the situation to "cause social disorder."
Hundreds of people have been arrested and the government has reassured foreign investors that it attaches a "special importance" to ensuring their safety.
How is this likely to end?
Alexander Neill from IISS predicts relations between the two will be strained for some time, but trade ties between the countries are likely to offer a way forward.
"I think there's a common misperception that the party-to-party relationship, the two communist parties in China and Vietnam, have this deep and understanding relationship. I don't think that's necessarily true. I think to a large extent this relationship is cosmetic," he said.
"The real business of the relationship is in trade so that might be an area where there could be a way out, or channels of communication could speak more than political acrimony.
"The Vietnamese authorities can't afford to lose very significant chunks of investment into their economy."