White House national security adviser Jake Sullivan on Thursday met with China’s leader, Xi Jinping, and held rare talks with a top Chinese military official in a sign that the two countries are communicating at senior levels despite tensions over the South China Sea and Taiwan.

Sullivan’s meeting with Gen. Zhang Youxia, vice chair of China’s Central Military Commission, was the first in years between a senior U.S. official and a vice chair of the commission, which oversees China’s armed forces and is chaired by Xi. In 2018, Jim Mattis, who was the U.S. defense secretary at the time, met with Gen. Xu Qiliang, who held the vice chair position.

It was the latest effort by the two powers to keep communication channels open even as disputes grow over national security, trade and geopolitics. On the military front, the United States has argued that more open communication is necessary to prevent accidents between the two countries’ warplanes and navy ships as they regularly patrol contested areas like the Taiwan Strait and the South China Sea.

Sullivan’s meeting with Zhang came on the final day of his three-day visit to Beijing to bolster the Biden administration’s bid to manage competition with China.

China and the U.S. have been locked in a rivalry for global influence and have seen tensions rise over a raft of issues, including China’s territorial claims in the South China Sea, its tacit support for Russia’s war in Ukraine, and the flood of Chinese electric vehicles and solar panels onto global markets.

“We believe that competition with China does not have to lead to conflict and confrontation — the key is responsible management through diplomacy,” Sullivan said at a news conference after meeting with Xi.

Even as the visit was a chance for both nations to reassure the world that they were working to lower the risk of conflict between them, it was clear that they were still fundamentally divided on strategic issues. China has rejected Washington’s framing of the bilateral relationship as being defined by competition, a stance Xi highlighted at the top of an official summary of the meeting.

“First of all, we must answer the general question of whether China and the United States are rivals or partners,” Xi told Sullivan. China’s intentions are “aboveboard,” he said, and his country is committed to “peaceful development.” He said he hoped that the United States would work with China to “find a correct way for the two major countries to get along.”

Sullivan told reporters the Biden administration’s priorities in its final months include greater communication between their militaries and more cooperation to tackle the fentanyl crisis in the United States.

He also elaborated on discussions about a potential meeting between President Joe Biden and Xi, noting that both leaders would likely attend the Asia-Pacific Economic Cooperation summit in Peru and the Group of 20 Leader’s Summit in Brazil, to be held in November.