Japan and China on Sunday marked the 40th anniversary of the signing of a treaty of peace and friendship between the two countries amid a period of warming ties and a changing dynamic in bilateral relations due to Beijing becoming a superpower.

Recently, China has been apparently attempting to bolster its political clout abroad on the back of its increasing economic and military might in a bid to snatch the “hegemony” enjoyed by the U.S. in the Asia-Pacific region, Japanese government officials say.

Although Tokyo has been seeking to boost ties with Beijing for regional stability, some diplomats warn that China is likely to start trying to drive a wedge into the Japan-U.S. alliance, which has great influence in the economic and security fields in Asia.

“I’d like to lead Japan-China relations to a new stage by promoting the overall improvement in bilateral ties,” Prime Minister Shinzo Abe told Chinese Premier Li Keqiang during their meeting in Tokyo in May.

A Japanese government official voiced hope for improvement in Japan-China relations, saying, “With depopulation shrinking the economy, Japan will not be able to maintain national strength without China’s cooperation.”

Tokyo and Beijing have agreed to resume reciprocal visits by the two countries’ leaders. Abe is planning to visit China later this year, and next year Chinese President Xi Jinping is expected to make his first trip to Japan since he became the country’s leader in 2013.

For years, the two neighbors have been mired in a territorial row over the Senkaku Islands in the East China Sea. The group of uninhabited islets, which are called Diaoyu in China, are controlled by Japan but claimed by Beijing.

The dispute intensified particularly after the government of former Prime Minister Yoshihiko Noda, Abe’s predecessor, decided to bring the Senkakus under state control in September 2012.

But the situation has changed significantly in recent years.

The criticism of Japan over the Senkakus and for its past war crimes had often been a way for Chinese leaders to garner political support at home, but Xi no longer has to do so, foreign affairs experts say.

“Rather, President Xi now believes that it is inadvisable to deteriorate ties with Japan to limit U.S. influence in the region,” a diplomat in Beijing from one of the 10 Association of Southeast Asian Nations member states said.

China and the United States have been at odds over Taiwan and the South China Sea, home to some of the world’s busiest sea lanes, where Beijing and several Southeast Asian countries have overlapping maritime claims.

In recent years, China has rapidly built artificial islands with military infrastructure in the contested waterway, while Washington has forged close relations with self-ruled, democratic Taiwan, which Beijing considers a renegade province awaiting reunification.

“China may think that if China and Japan become good friends, Japan would stop joining the United States in pointing fingers at what China does and would begin to cooperate with China’s projects to extend its influence in the region,” the ASEAN diplomat said.

Beijing has sought to expand infrastructure networks in Asia, the Middle East, Europe and Africa to improve connections between nations along the ancient Silk Road trade routes under its “One Belt, One Road” initiative.

The administration of U.S. President Donald Trump is cautious about China’s move, but amid warming Sino-Japanese ties, Abe has expressed readiness to work in tandem with Beijing to push ahead with the project.

While China and the United States have been locked in a tit-for-tat trade war, Beijing and Tokyo have pledged to step up bilateral cooperation to tackle protectionism by Trump and safeguard free trade.

“At least on the economic front, Japan has already become much closer to China than the United States, and this tendency is likely to continue,” another diplomat in Beijing said.

“Japan should be careful not to be taken in by China. The worst-case scenario is that Japan will weaken its bond with the United States. On the security front, the U.S.-Japan alliance remains extremely important for Japan and the Asia-Pacific region,” he added.

The Treaty of Peace and Friendship between Japan and China was signed in 1978, six years after the two countries normalized diplomatic relations.

The accord stipulates that the two nations will develop bilateral ties based on the principles of “mutual respect for sovereignty and territorial integrity, mutual nonaggression, noninterference in each other’s internal affairs, equality and mutual benefit and peaceful coexistence.”

It also says that the two countries “in their mutual relations (shall) settle all disputes by peaceful means and shall refrain from the use or threat of force.”

In the same year as the treaty was signed, the People’s Republic of China, founded by the Communist Party in 1949, adopted its landmark economic reform policy.

It overtook Japan as the world’s second-biggest economy in nominal gross domestic product in 2010.