BEIJING/MANILA (Reuters) - China and the Philippines have agreed to avoid force to resolve their differences over the South China Sea, according to a joint statement issued on Thursday by China at the end of a visit to Manila by Chinese Premier Li Keqiang.

Slideshow ( 2 images )

China and the Philippines have long sparred over the South China Sea, but relations have improved considerably under Philippine President Rodrigo Duterte.

Malaysia, Taiwan, Brunei, Vietnam and the Philippines claim some or all of the South China Sea and its myriad shoals, reefs and islands. China claims most of the waterway and has been aggressively building and militarizing artificial islands.

The joint statement, carried by China’s official Xinhua news agency, said China and the Philippines reaffirmed the importance of peace in the South China Sea and of freedom of navigation and overflight.

There should be no violence or threats of violence and the dispute should be resolved via talks between the “relevant sovereign countries”, it added.

“Both sides believe that the maritime dispute is not the full sum of the China-Philippines relationship,” the statement said.

In a separate statement summing up discussions at the Association of Southeast Asian Nations summit, Duterte took note of the “improving relations between ASEAN and China” in the South China Sea.

“In view of this positive momentum, we looked forward to the announcement of the start of substantive negotiations on the Code of Conduct (COC) with China” he said, hopefully in early 2018 in Vietnam, where the two sides will meet at the earliest.

ASEAN and China have been discussing a set of rules on how to behave in the disputed waters to avoid accidents and raising tension.

Duterte said the two sides also had successfully tested the hotline among foreign ministries on how to manage maritime emergencies.

“In our view, these are practical measures that could reduce tensions, and the risks of accidents, misunderstandings and miscalculation,” he said.