SEOUL, South Korea — The rival Koreas moved toward easing their bitter animosity Tuesday during rare talks, with North Korea agreeing to take part in next month’s Winter Olympics in South Korea. The countries also agreed to hold more discussions on reducing tension along their border and to reopen a military hotline.

The first meeting of its kind between the nations in about two years was arranged after North Korean leader Kim Jong Un made an abrupt push for improved ties with South Korea following a year of escalating tensions with the outside world over his expanding nuclear and missile programs. Critics say Kim may be trying to divide Seoul and Washington in a bid to weaken international pressure and sanctions on the North.

In comments that appeared to back up those critical views, chief North Korean delegate Ri Son Gwon said his country’s nuclear weapons are aimed at the United States, not South Korea. He made the comments while complaining about what he called inaccurate South Korean media reports that he said Tuesday’s talks dealt with North Korea’s nuclear disarmament.

“All our state-of-the-art strategic weapons like atomic bombs, hydrogen bombs and intercontinental ballistic rockets are completely targeting the United States. They are not targeting our compatriots” in the South, Ri said, according to media footage from the border village of Panmunjom, where the talks were held.

Despite Ri’s comments, the agreements were still seen to be a positive move. Chief South Korean delegate Cho Myoung-gyon described the accords as a “first step toward the development of South-North relations” when he briefed reporters about the meeting.

Ri read what he called a joint statement after the talks, under which the two Koreas agreed to “actively cooperate” in the Olympics to “enhance the prestige of the Korean people.”

He said North Korea will send a delegation of officials, athletes, cheerleaders and journalists to the Feb. 9-25 games in Pyeongchang, South Korea.

South Korea will provide necessary services to the North Korean delegation, Ri said, adding that the two countries will hold follow-up working-level talks on Olympic cooperation.

“I see North Korea’s participation in the Pyeongchang Games will provide us with a chance to reduce tension on the Korean Peninsula,” said Cho, whose official title is unification minister.

U.S. State Department spokeswoman Heather Nauert welcomed the inter-Korean meeting which she said was “aimed at ensuring a safe, secure and successful” Olympics. The U.S. said it was consulting with South Korean officials to ensure that North Korea’s participation in the games does not violate U.N. sanctions imposed over its nuclear weapons.

North Korea’s participation in the Winter Olympics won’t affect U.S. participation in the games, White House spokeswoman Sarah Huckabee Sanders said, adding that the decision presents North Korea with an opportunity to see the value of ending its isolation from the rest of the world.

North Korea is not a winter sports power, and two of its figure skaters, Ryom Tae Ok and Kim Ju Sik, earlier became the only North Korean athletes to qualify for the games before the North missed a confirmation deadline. The International Olympic Committee said Monday it has “kept the door open” for North Korea to take part in the games.

Sports ties between the two countries mirror their rocky political relationship.

During an earlier era of inter-Korean detente, athletes from the North and South paraded together at international sports events such as the Olympics and fielded a unified Korean team. The government of current South Korean President Moon Jae-in had wanted the two Koreas to agree to similar reconciliatory steps in Pyeongchang.

North Korea boycotted the 1986 Asian Games and the 1988 Summer Olympics, both held in Seoul, amid Cold War rivalry. One year before the 1988 Games, a South Korean passenger plane exploded, killing all 115 people aboard, and a captured North Korean agent told South Korean investigators that she bombed the jetliner at the order of North Korean leaders who wanted to disrupt the Seoul Olympics.

In another key accord Tuesday, North Korea also agreed to hold military talks aimed at reducing animosity along the border and to restore a military hotline communication channel with South Korea, according to Cho.

The restoration of the hotline was the second such move in a week. All major inter-Korean communication channels had been shut down over the North’s nuclear program in recent years. But North Korea reopened one channel last week as signs emerged of improving ties.

Cho said South Korea also called for talks at an early date to discuss denuclearization of the Korean Peninsula to promote peace. He said the two Koreas would continue high-level talks but didn’t give a date for the next meeting.

Earlier Tuesday, South Korean officials said they also suggested resuming temporary reunions of families separated by war, but the joint statement didn’t mention this.

The countries have a long history of failing to follow through with rapprochement accords. In 2015, negotiators met for nearly 40 hours before announcing a deal to pull back from a military standoff caused by land mine blasts that maimed two South Korean soldiers. But animosities flared again several months later after the North’s fourth nuclear test.

The meeting’s venue, Panmunjom, is the only place on the border where North and South Korean soldiers are just meters (feet) away from each other. In November, a North Korean soldier defected to the South across Panmunjom amid gunfire from his comrades. He was hit five times but survived.

An agreement on the North’s Olympic participation had been widely expected before the talks, but the Koreas appeared to remain sharply at odds over how to improve their overall ties.

North Korea was expected to demand rewards in return for South Korea’s proposal of family reunions, such as a halt to South Korean propaganda broadcasts and a scaling back or halting of military drills with the U.S., observers say. But it wasn’t known if the North made such a demand.

Suspension of the military drills would be unacceptable for Seoul because it would seriously undermine its alliance with its chief ally, the United States, which wants to put more pressure on North Korea. The North views the drills as a rehearsal for an invasion.

U.S. President Donald Trump on Saturday expressed hope for progress from the talks and said he was open to talking with Kim himself. But U.N. Ambassador Nikki Haley later said Washington isn’t changing its conditions on talks with North Korea, saying Kim first needs to stop weapons testing for a “significant amount of time.”

In his New Year’s Day address, Kim said he was willing to send a delegation to the Pyeongchang Games. He urged Seoul to halt the military drills with the U.S. and said he has a “nuclear button” to launch missiles at any target in the United States. Moon welcomed Kim’s outreach and proposed the talks at Panmunjom.

Trump and Kim traded bellicose rhetoric and crude insults last year, as North Korea conducted its sixth and most powerful nuclear detonation and three tests of intercontinental ballistic missiles.