VIETNAM and China share a long history of enmity—and of managing to patch things up when they go wrong. But their latest dispute is not running true to form.

Vietnam was taken aback in early May when China parked an oil rig on its doorstep. The behemoth, which cost $1 billion, lies 17 nautical miles (32 km) from the Paracel islands, which China seized from the American-backed South Vietnamese regime in 1974, and about 150 nautical miles from the Vietnamese coast. Vietnam’s leaders say the rig is inside their 200-mile exclusive economic zone as defined by international law. They wanted to settle the dispute quickly through negotiations. But China is said to have rebuffed requests for a summit and talks between lower-ranking officials went nowhere.

Now, the prospect of a quiet resolution looks increasingly remote. As the two countries’ boats circle each other near the rig, diplomats from both sides are circulating complaints to the UN. It is an unusual move for China, which normally eschews international bodies in its disputes with other countries. The South China Morning Post, a newspaper based in Hong Kong, reported on June 9th that China had temporarily banned its state-owned firms from bidding on new contracts in Vietnam. That followed two days of anti-Chinese riots in mid-May, in which four Chinese workers were killed, and the sinking, in late May, of a wooden Vietnamese fishing boat that collided with a Chinese adversary.

The dust-up is among the worst since 1979, when Vietnam gave China a bloody nose in a brief border war. The prime minister, Nguyen Tan Dung, said on May 21st that Vietnam may, like the Philippines, challenge China’s territorial claims in the South China Sea in an international court.

That could win Mr Dung domestic praise, but it is also risky. Vietnam’s manufacturing sector depends heavily on imported Chinese raw materials. The ruling Communist Party of Vietnam also has a strong pro-China faction that regards their country’s improving ties with the United States with deep suspicion.

The betting is that China will remove its rig by mid-August, as planned. But the thornier issue of who owns what in the South China Sea—which the Vietnamese call the East Sea—is unlikely to be settled so soon. Meanwhile, Vietnam is bracing for short-term economic pain. HSBC, a bank, reports that manufacturing growth fell slightly from April to May. Foreign investment is helping to prop the economy up; Mr Dung is trying to assure foreigners that his country is still a good place to invest. But deadly riots and a stand-off with China are hardly great advertisements.