SEOUL, SOUTH KOREA -- South Korea said Thursday that it would consider , a major policy change that was suggested after Russia and North Korea rattled the region and beyond by signing a pact to come to each other鈥檚 defense in the event of war.

The comments from a senior presidential official came hours after North Korea鈥檚 state media released the details of the agreement, which observers said could mark the strongest connection between Moscow and Pyongyang since the end of the Cold War. It comes at a time when Russia faces growing isolation over the war in Ukraine and both countries face escalating standoffs with the West.

According to the text of the deal published by North Korea鈥檚 official Korean Central News Agency, or KCNA, if either country gets invaded and is pushed into a state of war, the other must deploy 鈥渁ll means at its disposal without delay鈥 to provide 鈥渕ilitary and other assistance.鈥 But the agreement also says that such actions must be in accordance with the laws of both countries and Article 51 of the United Nations Charter, which recognizes a U.N. member state鈥檚 right to self-defense.

North Korean leader Kim Jong Un and Russian President Vladimir Putin signed the pact at a summit Wednesday in Pyongyang. Both described it as a major upgrade of bilateral relations, covering security, trade, investment, cultural and humanitarian ties.

The office of South Korean President Yoon Suk Yeol issued a statement condemning the agreement, calling it a threat to his country's security and a violation of U.N. Security Council resolutions, and warned that it would have negative consequences on Seoul鈥檚 relations with Moscow.

鈥淚t鈥檚 absurd that two parties with a history of launching wars of invasion 鈥 the Korean War and the war in Ukraine 鈥 are now vowing mutual military cooperation on the premise of a preemptive attack by the international community that will never happen,鈥 Yoon鈥檚 office said.

At the United Nations in New York, South Korean Foreign Minister Cho Tae-yul called it 鈥渄eplorable鈥 that Russia would act in violation of multiple U.N. sanctions resolutions against North Korea that Moscow voted for.

Yoon鈥檚 national security adviser, Chang Ho-jin, said that Seoul would reconsider the issue of providing arms to Ukraine to help the country fight off Russia鈥檚 full-scale invasion.

Russia-North Korea deal

South Korea, a growing arms exporter with a well-equipped military backed by the United States, has provided humanitarian aid and other support to Ukraine, while joining U.S.-led economic sanctions against Moscow. But it hasn't directly provided arms to Kyiv, citing a longstanding policy of not supplying weapons to countries actively engaged in conflict.

Speaking to reporters in Hanoi, where he traveled after Pyongyang, Putin said Thursday that supplying weapons to Ukraine would be 鈥渁 very big mistake鈥 on South Korea's part. If that happens, Putin said that it would lead to "decisions that are unlikely to please the current leadership of South Korea.鈥

He said that South Korea 鈥渟houldn鈥檛 worry鈥 about the agreement, if Seoul isn't planning any aggression against Pyongyang.

Asked whether Ukrainian strikes on Russian regions with Western-supplied weapons could be considered an act of aggression, Putin said that 鈥渋t needs to be additionally studied, but it鈥檚 close to it,鈥 and that Moscow isn't ruling out supplying weapons to North Korea in response.

A number of NATO allies, including the United States and Germany, recently authorized Ukraine to hit some targets on Russian soil with the long-range weapons they are supplying to Kyiv. Earlier this month, a Western official and a U.S. senator said that Ukraine has used American weapons to strike inside Russia.

Putin has said in response that Moscow 鈥渞eserves the right鈥 to arm Western adversaries, and reiterated that notion on Thursday.

鈥淚 said, including in Pyongyang, that in this case we reserve the right to supply weapons to other regions of the world," he said. "Keeping in mind our agreements with the Democratic People鈥檚 Republic of Korea, I鈥檓 not ruling that out.鈥

The summit between Kim and Putin came as the U.S. and its allies expressed growing concern over a possible arms arrangement in which Pyongyang provides Moscow with badly needed munitions for the war in Ukraine, in exchange for economic assistance and technology transfers that could enhance the threat posed by Kim鈥檚 nuclear weapons and missile program.

Following their summit, Kim said the two countries had a 鈥渇iery friendship,鈥 and that the deal was their 鈥渟trongest-ever treaty,鈥 putting the relationship at the level of an alliance. He vowed full support for Russia鈥檚 invasion of Ukraine. Putin called it a 鈥渂reakthrough document,鈥 reflecting shared desires to move relations to a higher level.

North Korea and the former Soviet Union signed a treaty in 1961, which experts say necessitated Moscow鈥檚 military intervention if the North came under attack. The deal was discarded after the collapse of the USSR, replaced by one in 2000 that offered weaker security assurances.

There鈥檚 ongoing debate on how strong of a security commitment the deal entails. While some analysts see the agreement as a full restoration of the countries鈥 Cold War-era alliance, others say the deal seems more symbolic than substantial.

Ankit Panda, a senior analyst at the Carnegie Endowment for International Peace, said that the text appeared to be carefully worded as to not imply automatic military intervention.

But "the big picture here is that both sides are willing to put down on paper, and show the world, just how widely they intend to expand the scope of their cooperation,鈥 he said.

The deal was made as Putin visited North Korea for the first time in nearly a quarter-century, a trip that showcased their personal and geopolitical ties. Kim hugged Putin twice at the airport, their motorcade rolling past giant Russian flags and Putin portraits, before a welcoming ceremony at Pyongyang鈥檚 main square attended by what appeared to be tens of thousands of spectators.

According to KCNA, the agreement also states that Pyongyang and Moscow must not enter into agreements with third parties, if they infringe on the 鈥渃ore interests鈥 of any of them and mustn't participate in actions that threaten those interests.

KCNA said that the agreement requires the countries to take steps to prepare joint measures for the purpose of strengthening their defense capabilities to prevent war and protect regional and global peace and security. The agency didn鈥檛 specify what those steps are, or whether they would include combined military training and other cooperation.

The agreement also calls for the countries to actively cooperate in efforts to establish a 鈥渏ust and multipolar new world order,鈥 KCNA said, underscoring how the countries are aligning in face of their separate confrontations with the United States.

How the pact affects Russia's relations with South Korea is a key development to watch, said Jenny Town, a senior fellow at the Stimson Center in Washington and director of the North Korea-focused 38 North website.

鈥淪eoul had already signed onto sanctions against Russia for its invasion of Ukraine, souring its relations with Moscow. Now with any ambiguity of Russia鈥檚 partnership with North Korea removed, how will Seoul respond?鈥 she said. 鈥淚s there a point where it decides to cut or suspend diplomatic ties with Russia or expel its ambassador? And have we reached it?鈥

Kim has made Russia his priority in recent months as he pushes a foreign policy aimed at expanding relations with countries confronting Washington, embracing the idea of a 鈥渘ew Cold War鈥 and trying to display a united front in Putin鈥檚 broader conflicts with the West.

Tensions on the Korean Peninsula are at their highest point in years, with the pace of both Kim鈥檚 weapons tests, and combined military exercises involving the U.S., South Korea and Japan intensifying in a tit-for-tat cycle.

The Koreas also have engaged in Cold War-style psychological warfare that involved North Korea dropping tons of trash on South Korea with balloons, and Seoul broadcasting anti-North Korean propaganda with its loudspeakers.

Edith M. Lederer contributed to this report from the United Nations.