BEIJING — It is the pride of China’s state-run oil industry and the nation’s first deepwater drilling rig, a vessel as big as a football field and as tall as a 40-story building, with a $1 billion price tag. Last week, it crawled through the South China Sea, pulled by heavy-duty tugs, and parked in one of the most sensitive spots possible, about 17 miles off a speck of an island claimed by both China and Vietnam.

The Vietnamese, at times embraced in brotherly Communist Party fealty by China, were taken by surprise. Hanoi assumed the rig, known as HD-981, was just passing through, people close to the government said.

At least twice in recent years, China has sought to explore these waters and backed down after protests by Vietnam. Just six months ago, during a visit of the Chinese prime minister to Hanoi, the two sides announced that they would try to find ways to jointly develop oil and gas fields.

That good will evaporated this week when Beijing made clear the drilling rig was staying put. It set off four days of confrontation, with dozens of Chinese and Vietnamese naval vessels ramming one another and China using water cannons in a standoff that threatens to push a region known for its economic development toward military conflict.