SEOUL, South Korea — President Vladimir Putin of Russia will visit North Korea this week for a meeting with its leader, Kim Jong Un, their second in nine months, as the countries deepen military ties to support Putin’s war in Ukraine with North Korean weapons.

Putin last visited North Korea in 2000, when he became the first Russian or Soviet leader to visit the nation. This week’s trip, beginning Tuesday, highlights North Korea’s growing strategic importance for Putin, especially its ability to supply badly needed conventional weapons for the war in Ukraine.

Kim met with Putin in Russia’s Far East in September, ushering in a new era of relations between the two countries.

For Kim, it was a rare moment for his country, a pariah in the West, being sought-after as an ally. For Russia, it’s a strengthening of ties with a country that is providing much-needed munitions for its war in Ukraine.

The two countries announced the two-day visit Monday. “At the invitation of the chairman of state affairs of the DPRK, Kim Jong Un, Vladimir Putin will pay a friendly state visit to the Democratic People’s Republic of Korea on June 18-19,” the Kremlin said.

Days before Putin’s arrival in Pyongyang, the North Korean capital, the Kremlin vowed to foster cooperation with North Korea “in all areas.”

Pyongyang and Moscow were Cold War-era allies whose relations cooled after the disintegration of the Soviet Union. But in the past couple of years, they have grown closer as a result of shared hostility toward the United States — Russia over its war against Ukraine, North Korea over its nuclear weapons program.

As the war in Ukraine has dragged on, Russia has found itself in urgent need of conventional weapons, especially artillery shells. North Korea has plenty to offer. In return, Kim wants to upgrade his weapons systems, and Russia has advanced military technologies and other aid to share.

Since Russia launched the full-scale invasion of Ukraine in February 2022, North Korea has sent Russia thousands of shipping containers’ worth of munitions, officials from the United States and South Korea say. Moscow, they say, has reciprocated by sending thousands of containers filled with economic and other aid.

In the weeks before Putin’s visit, Kim flaunted what he has to offer Putin. While visiting munitions factories last month, he praised them for increasing production and showed off warehouses full of short-range ballistic missiles — of a kind similar to the North Korean missiles that Washington has said Russia fired at Ukraine.

Moscow and Pyongyang deny the arms trade, which is banned under United Nations sanctions. But at the Group of 7 summit in Italy last week, the G7 leaders condemned “in the strongest possible terms the increasing military cooperation” between the two nations, including North Korea’s export of ballistic missiles and Russia’s use of them against Ukraine.

“The fact that President Putin is making this trip means that because of its war in Ukraine, Russia is badly in need” of North Korean weapons, Chang Ho-jin, the South Korean national security adviser, told Yonhap News TV over the weekend. “The North Koreans will try to get as much as possible in return, because the situation looks favorable to them.”

Chang said South Korea had warned Moscow before Putin’s trip that it “should not cross certain lines.” He did not elaborate. But some analysts in South Korea have speculated that during Putin’s trip, North Korea may seek Russian help improving its nuclear weapons capabilities and try to reinstate Cold War-era military ties with Moscow.

Things had looked grim for Kim until the war in Ukraine created opportunities for him. For years, his country’s economy was devastated by the sanctions the U.N. Security Council imposed to deter his nuclear weapons program. Kim’s attempt to lift the sanctions collapsed when his direct diplomacy with President Donald Trump ended in 2019 without an agreement.

Kim’s answer was to double down on his nuclear weapons program, while envisioning a “Neo-Cold War” in which his country hoped to elevate its strategic value for China and Russia in Northeast Asia while the United States, Japan and South Korea expanded their own military cooperation.

North Korea was among the few countries to openly support Putin’s invasion of Ukraine. In return, Putin invited Kim to the Vostochny Cosmodrome in the Russian Far East last year and indicated that Russia could help North Korea launch satellites.

Kim wants satellites to better monitor his military targets but has had trouble putting them into orbit.