BEIJING (Reuters) - China is committed to peace but cannot give up “even one inch” of territory that the country’s ancestors left behind, Chinese President Xi Jinping told U.S. Defense Secretary Jim Mattis on Wednesday during his first visit to Beijing.

Xi’s remarks underscored deep-rooted areas of tension in Sino-U.S. ties, particularly over what the Pentagon views as China’s militarization of the South China Sea, a vital transit route for world trade.

But irritants in U.S.-China relations extend to other sensitive areas, including fears of a full-blown trade war between the world economic heavyweights.

Beijing is also deeply suspicious of U.S. intentions toward self-governing and democratic Taiwan, which is armed by the United States. China views the island as a sacred part of its territory.

Meeting in Beijing’s Great Hall of the People, Xi told Mattis that China had only peaceful intentions and would not “cause chaos,” state television reported.

Both countries’ common interests far outweigh their differences, but on territorial issues there can be no concessions, Xi said, without referring to specific areas.

“We cannot lose even one inch of the territory left behind by our ancestors. What is other people’s, we do not want at all,” state television cited Xi as saying.

Mattis, in comments in front of reporters, told Xi the talks had been “very, very” good.

“I am happy to be in China and we are assigning the same high degree of importance to the military relationship” with China, Mattis said.

Slideshow ( 9 images )

That relationship has been tested in recent months. In May, the Pentagon withdrew an invitation to China to join a multinational naval exercise, citing China’s military moves in the South China Sea. The U.S. decision upset Beijing and was raised during Mattis’ talks, officials said.

U.S. defense officials told reporters traveling with Mattis that the talks were generally positive and candid. While both sides acknowledged points of friction, they also sought to focus on areas of alignment -- including a shared goal of denuclearization of the Korean peninsula.

“Areas of disagreement were identified but not necessarily dwelt upon,” said Randall Schriver, assistant secretary of defense for Asian and Pacific security affairs, saying both sides agreed to continue discussions on the South China Sea.

AVOIDING CONFRONTATION

Meeting earlier in the day, China’s Defense Minister Wei Fenghe told Mattis that only with mutual respect and by avoiding confrontation can China and the United States develop together.

“China and the United States can only develop together if we maintain no conflict, no confrontation, mutual respect and win-win cooperation,” Wei added.

“China and the United States’ two militaries must implement the consensus of the two countries’ leaders, increase mutual trust, strengthen cooperation and manage risks to turn ties between the two militaries into a factor for stability in the bilateral relationship.”

Mattis, the first Pentagon chief to visit China since 2014, told Wei he expected all of his conversations in Beijing would be characterized by an “open and honest” dialogue.

Slideshow ( 9 images )

“The military-to-military relationship is critical to the broader relationship between our two countries,” Mattis added, in comments also in front of reporters.

Mattis invited Wei to visit him at the Pentagon.

Wei was similarly upbeat in his public remarks.

“Your visit to China this time is ... a new positive factor to the military-to-military and state-to-state relationship,” said Wei, who only assumed his position in March.

TAIWAN TENSION

The Chinese defense ministry statement made only passing mention of the South China Sea, Taiwan and North Korea, citing Wei as telling Mattis what China’s positions were on those issues. China even made passing reference to concerns about trade with the United States, officials said.

As Mattis arrived, Chinese state media said a formation of Chinese warships had been holding daily combat drills for more than a week in waters near Taiwan, and there have been frequent Chinese air force exercises near the island.

While China and the United States have tried hard to keep lines of communication between their militaries open, especially at the senior level, they are deeply suspicious of each other.

Still, the United States and China have broad strategic common interests, such as ensuring peace and stability on the Korean peninsula.

China welcomed the historic summit between U.S. President Donald Trump and North Korean leader Kim Jong Un earlier this month in Singapore, where Kim reaffirmed a commitment to work toward complete denuclearization of the Korean peninsula, while Trump said he would halt joint U.S.-South Korean “war games.”