Hanoi - Chinese President Xi Jinping Thursday said he hoped for a "higher level" partnership with Vietnam on a visit that has angered Vietnamese nationalists at a time of bubbling conflict over the South China Sea.
The communist neighbours have long celebrated their political and economic ties but in recent years tensions have flared over a decades-old feud about island chains in the contested waters.
On arriving in Hanoi, Xi said he hoped the visit would "consolidate (their) traditional friendship" and lift Sino-Vietnamese "co-operation to a higher level" in a statement released in Vietnamese.
The Chinese leader was welcomed with a 21-gun salute before being greeted by ruling Communist Party chief Nguyen Phu Trong.
But hours before Xi arrived - on the first visit by a Chinese president to Vietnam in 10 years - a very different scene played out in small but rare protests on the streets of Hanoi and southern Ho Chi Minh City.
"Protesting Xi Jinping's visit" said one of the placards held aloft by about a dozen demonstrators in the capital, as others carried pictures of Xi marked with an "X" across his image.
But unlike protests earlier this week, they were quickly disbanded, witnesses told AFP, saying demonstrators in Hanoi were funnelled into buses and driven away.
Posts on social media said around 20 people were detained in Ho Chi Minh City after a larger anti-China protest, with a video showing a bloodied demonstrator after clashes with police.
Rallies are rare in authoritarian Vietnam but the ruling regime has in recent years tolerated low levels of dissent against its main ally China.
Anger against Xi's visit has also been brewing online - a more common outlet for grievances despite the routine arrests of political bloggers.
"Immediately end activities which threaten the lives, property and right to freedom" of Vietnamese fishermen, said a petition signed by hundreds and shared on Facebook, referring to the disputed isles.
Relations between Vietnam and China plummeted to their lowest point in decades in May 2014 when Beijing moved an oil rig into waters claimed by Hanoi in the South China Sea.
The anti-China riots that ensued targeted foreign-invested factories and saw the Asian giant evacuate thousands of its nationals after at least three Chinese were killed.
Patriotic sentiments still run high in Vietnam, and Xi's visit has been viewed by observers as an attempt to improve relations after that episode.
He "aims to calm down Vietnam and other countries over the recent construction by China" in the South China Sea, said Duong Danh Dy, a former Vietnamese diplomat in Beijing.
Xi is also scheduled to meet Vietnamese President Truong Tan Sang and Prime Minister Nguyen Tan Dung during his two-day trip.
Last week Chinese officials told reporters in Beijing that the territorial dispute would be discussed as well as co-operation on trade, education and infrastructure.
China lays claim to almost all of the South China Sea, parts of which are also claimed by the Philippines, Brunei, Malaysia and Taiwan as well as Vietnam.
Japan and China are also locked in a row over disputed islands in the East China Sea.
In recent months Vietnam has been trying to strengthen bonds with other nations to counter China's growing regional prowess.
Communist Party general secretary Trong was received by US President Barack Obama in July, the first party chief to visit the country and the White House.
Vietnam is also party to the recently sealed Trans-Pacific Partnership, the world's largest free trade deal between 12 nations, including the US and Japan, but notably not Beijing. The TPP is viewed by some as a counterbalance to growing Chinese economic clout.
Japanese Defence Minister Gen Nakatani is also currently in Vietnam on an unrelated visit. He was due to tour a strategic naval base earlier Thursday, according to Vietnamese state media.
Despite their political closeness, Vietnam and China fought a brief but bloody war in 1979 triggered by Hanoi's invasion of Cambodia.