Image copyright AFP Image caption Tens of thousands of US military personnel are based in South Korea

South Korea's government has said US troops will remain in the country, even if a deal is reached to formally end the Korean War.

About 29,000 US soldiers are based in South Korea, under a security agreement reached after the war ended in 1953.

North Korea has previously made giving up its nuclear weapons conditional on the troops leaving the peninsula.

But a South Korean government spokesman said their presence was "nothing to do with signing peace treaties".

"US troops stationed in South Korea are an issue regarding the alliance between South Korea and the United States," said Kim Eui-kyeom, speaking for President Moon Jae-in.

In their breakthrough meeting last Friday, Mr Moon and North Korea's Kim Jong-un agreed to work towards a denuclearised Korean peninsula and a peace treaty to formally end the Korean War.

The war ended in 1953 with an armistice, so the Koreas are still technically at war.

Media playback is unsupported on your device Media caption The moment Kim Jong-un crossed into South Korea

The adviser's comment came in response to a newspaper column, written by an adviser to Mr Moon, which said it would be difficult to justify a continuing US troop presence if a peace treaty were to be signed.

'Security guarantee'

While North Korea has been vocally opposed to the US troops in the past - and has been angered by joint US-Korean military drills - there was no explicit mention of them in the Panmunjom Declaration reached at the end of the summit.

Key outcomes of the Korean summit

Image copyright Getty Images

A commitment to "a nuclear-free Korean peninsula" and an end to "hostile activities" between the two countries

Changing the demilitarised zone (DMZ) into a "peace zone," including ceasing propaganda broadcasts

An arms reduction in the region pending the easing of military tension

To push for four-way talks involving the US and China aimed at turning the armistice that ended the Korean war into a peace treaty

Organising a reunion of families left divided by the war

Connecting and modernising railways and roads across the border

Further joint participation in sporting events, including this year's Asian Games

Read the Panmunjom Declaration in full

The North Korean leader is reported, however, to have told South Korea that his country would have no need for nuclear weapons if its security was guaranteed.

Mr Kim is set to hold a further historic meeting in the coming weeks, this time with US President Donald Trump.

The meeting's agenda, date and location are yet to be determined.

But Mr Trump has previously questioned why the US is spending so much on its South Korean military presence.

White House chief of staff John Kelly this week fiercely denied comments from unnamed White House officials that Mr Trump had wanted to withdraw the entire deployment ahead of the Winter Olympics in Pyeongchang.