Image copyright Getty Images Image caption Mr Moon said Trump deserved credit for the pressure that had led North Korea to take part in talks

South Korea's President Moon Jae-in says his US counterpart, Donald Trump, "deserves big credit" for talks between South and North Korea.

The talks, held on Tuesday, were the first in two years and led to the announcement that North Korea would send a delegation to the Olympics in Pyeongchang later this year.

Mr Moon said he wanted to show Mr Trump his gratitude.

The US president tweeted a week ago that he had brought the talks about.

He said he had done so by being "firm, strong and willing to commit our total 'might' against the North".

Mr Moon told reporters on Wednesday: "I think President Trump deserves big credit for bringing about the inter-Korean talks.

"It could be a resulting work of the US-led sanctions and pressure," he said.

Later on Wednesday, a lone North Korean representative arrived at the International Olympic Committee headquarters in Switzerland to formalise the agreement to send athletes to the 2018 Games.

Image copyright Reuters Image caption A North Korean delegation led by Ri Son-gwon (R) met a South Korean delegation led by Cho Myoung-gyon on Tuesday

BBC correspondents in Seoul say Mr Moon is treading a difficult diplomatic line between wanting dialogue with the North but not wanting to annoy the US, an ally, or undermine economic sanctions.

Russia's foreign ministry welcomed the agreements reached to negotiate over military issues.

"We hope that their implementation will serve to de-escalate tensions on the Korean peninsula and foster stability in this region," the ministry said.

A lull in tensions for the Olympics

Jonathan Marcus, BBC defence and diplomatic correspondent

Mr Moon's statement in itself is an indication of the difficult line he has to walk. It is not impossible that Mr Trump's tougher line has indeed encouraged Pyongyang to test the diplomatic waters. But can these inter-Korean talks provide a starting point for tackling more fundamental problems like the North's nuclear programme?

Two things are clear.

North Korea has no intention of giving up its nuclear arsenal and it will need more tests to prove its capability.

And the US insists that Pyongyang will not be allowed to develop a capability to strike at the continental United States.

So the warming of ties between the two Koreas may provide a lull in tensions for the duration of the Olympics, but what then?

Mr Trump has previously said he would be willing to sit down with the North Korean leader Kim Jong-un in the future, under the right conditions.

Moon Jae-in underlined his commitment to a Korean peninsula without nuclear weapons a day after the talks. North Korea, however, refused to discuss nuclear matters, though it did agree to improving military contacts.

Image copyright Reuters Image caption Gymnasts from South Korea (Lee Eun-ju, R) and North Korea (Hong Un-jong) snapped a selfie together at the last summer Olympics

North Korea and South Korea are technically still at war with each other but at the 2016 Summer Olympics in Rio de Janeiro, gymnasts from the two countries were hailed for capturing the spirit of the Games when they posed together for a selfie.

What happened at Tuesday's talks?

Officials from South Korea reported that: