Japan's top national security adviser and his Chinese counterpart have agreed in talks that the countries will continue dialogue toward building constructive and stable bilateral ties, regardless of heightened tensions over Taiwan, their governments said Thursday.

During their about seven-hour meeting on Wednesday in the Chinese city of Tianjin, Takeo Akiba, secretary general of Japan's National Security Secretariat, protested to China's foreign policy chief Yang Jiechi over Beijing's recent large-scale drills near Taiwan, according to a Japanese government official.

Their talks came as Tokyo and Beijing prepare to mark the 50th anniversary of the normalization of diplomatic ties next month, though neither side appears in the mood for a grand celebration following a recent rapid deterioration of bilateral ties over the Taiwan issue.

Japanese national security advisor Takeo Akiba (L) and China's top diplomat Yang Jiechi pose for photos as they meet in Tianjin, China, on Aug. 17, 2022. (Photo courtesy of the National Security Secretariat)(Kyodo)

With the latest high-level talks held at the request of China, the two countries are believed to have discussed mending their ties and laying the groundwork for a summit meeting between Prime Minister Fumio Kishida and Chinese President Xi Jinping.

For Akiba, a former vice foreign minister who assumed his post in July last year, the Tianjin meeting was his first in-person talks with Yang.

China conducted the military exercises in areas encircling Taiwan in response to the visit earlier this month to the island by U.S. House of Representatives Speaker Nancy Pelosi, the third-highest-ranking official of the country.

Akiba reiterated Japan's protest over China's firing of ballistic missiles, five of which fell in Japan's exclusive economic zone, during the drills, and underscored the importance of peace and stability across the Taiwan Strait, according to the official.

Yang, a member of the Communist Party's decision-making Politburo, said Taiwan is "an inalienable part of China's territory," and that the Taiwan question concerns "the political foundation of China-Japan relations and the basic trust and good faith between the two countries," according to the Chinese government.

He said the 2,000-year history of exchanges between the two countries and the 50th anniversary of diplomatic relations this year have taught both sides that "peaceful coexistence and friendly cooperation are the only right choice."

Yang also stressed the need to "eliminate internal and external interference, and work together to build a China-Japan relationship that meets the requirements of the new era," according to the Chinese government.

The meeting also addressed the situation in Ukraine since Russia's invasion and North Korea.

After Japan and other members of the Group of Seven major democracies issued a joint statement rapping Beijing's increased military pressure on Taiwan with the drills, China abruptly canceled a foreign ministers' meeting with Japan scheduled for Aug. 4 in Cambodia.

Chinese Foreign Ministry spokesman Wang Wenbin on Thursday repeated Beijing's criticism of Japan over its action following Pelosi's Taiwan visit, saying it "supports U.S. erroneous moves and unwantedly accuses, smears China and grossly interferes" in the neighboring country's internal affairs.

"Japan should see the highly sensitive nature of the Taiwan question, see how dangerous and harmful it is to be involved" in Taiwan separatist activities, he said at a press conference in Beijing.

Wang reiterated that China does not accept Japan's EEZ claims, saying the two countries have yet to delineate the boundaries in relevant waters.

In addition to tensions over the self-ruled island, China shows no sign of stopping coast guard ships repeatedly intruding into Japanese waters around the Tokyo-controlled, Beijing-claimed Senkaku Islands.

Akiba and Yang, nevertheless, concurred that efforts by both sides and in-person, multilayered communication are needed in order to improve ties as agreed to by their leaders last year, the Japanese official said.

Last October, Kishida and Xi agreed to seek "constructive and stable" relations in the run-up to the 50th anniversary in their first phone talks since the Japanese leader took office.

Related coverage:

Japan, China arranging high-level talks amid Taiwan tension

Japan lawmaker advancing ties with Taiwan to visit island next week