Russian President Vladimir Putin and North Korean leader Kim Jong Un agreed to provide immediate military assistance if one of them is attacked, reviving an agreement dating back to the Cold War in a move likely to unsettle the US and its partners.

The two leaders signed the deal Wednesday during Putin’s first visit to North Korea in 24 years. Kim called the pact “the most powerful treaty” signed between the two countries and one that elevates their ties to an alliance.

“If either party is invaded by armed force by an individual state or states and face a war, the other party shall without delay and in accordance with Article 51 of the Charter of the United Nations and the laws of North Korea and Russia, provide military and other assistance with all the means at its disposal,” the treaty said, according to a text published Thursday from the official Korean Central News Agency.

After the signing ceremony, Kim said the deal is for defensive purposes but it raises the risks for the US and its partners in responding to provocations from Moscow and Pyongyang and is a symbol of their defiance against Western powers.

The pact, dubbed the Comprehensive Strategic Partnership Treaty, also says Russia and North Korea agreed to work together to strengthen their defense capabilities, while expanding cooperation in the trade and investment.

Putin’s trip came after Kim traveled to Russia in September, which as satellite imagery later showed was followed by a massive growth in arms transfers. Putin last visited Pyongyang in 2000 as Russia’s president. Moscow and Pyongyang have denied the arms transfers despite ample evidence showing them taking place.