SINGAPORE (Reuters) - China has always insisted the dispute in the South China Sea should be resolved peacefully through talks, but the government has a responsibility to protect the country's sovereignty and maritime rights, Chinese President Xi Jinping said on Saturday.

China has overlapping claims with Vietnam, the Philippines, Malaysia, Taiwan and Brunei in the South China Sea, through which $5 trillion in ship-borne trade passes every year.

Its land reclamation work in the sea has raised concern in the region about its intentions, and last week, a U.S. warship sailed within 12 nautical miles of one of Beijing's man-made islands in the contested Spratly archipelago.

Speaking at the National University of Singapore, Xi said freedom of passage in the South China Sea has never been a problem and will never be a problem, but the islands there have always been Chinese.

"To maintain the sovereignty and proper, reasonable maritime rights is a responsibility the Chinese government must take on," Xi said.

"Right of passage or flight has never been a problem and will never be a problem, because China needs the freedom of passage in the South China Sea the most," he added.

"Though some islets over which China has sovereignty have been occupied by others, China has always committed to solve the problem by peaceful negotiations," Xi said.

"China is committed to working with countries with a direct stake in the issue to solve the dispute on the basis of respect of historical facts, according to international laws and through discussions and negotiations."

China has the confidence and ability to maintain the peace and stability of the South China Sea area, Xi said.

In what appeared to be a comment directed at the United States, he added that China welcomed "countries from outside the region" to have a "positive influence" on peace and development in Asia.

Xi, on the second leg of a Southeast Asian trip that has also taken in Vietnam, has sought to strike a more conciliatory tone on the South China sea while in the region.

On Friday, China and Vietnam agreed to maintain peace at sea as Xi lauded relations with its much smaller but also communist-led neighbor.

Vietnam and China's competing territorial claims mushroomed into a major dispute last year after China parked an oil rig in disputed waters in the South China Sea, leading to anti-Chinese riots in Vietnam.