(CNN) Standing yards away from North Korea, US Defense Secretary James Mattis said Friday that the US and South Korea were committed to a "diplomatic solution" to address the country's "reckless behavior."

Mattis spoke during a visit to the demilitarized zone (DMZ) that divides North and South Korea, which came after Pyongyang this week renewed its threat to test a nuclear weapon above ground.

"North Korean provocations continue to threaten regional and world peace and despite unanimous condemnation by the United Nations' Security Council they still proceed," Mattis said.

US Secretary of Defence Jim Mattis (C) speaks to the media as South Korean Defence Minister Song Young-Moo (R) looks on during a visit to the truce village of Panmunjom in the Demilitarized Zone (DMZ) on October 27, 2017.

Facing away from North Korea, Mattis referenced the words of his colleague, US Secretary of State Rex Tillerson, saying that "our goal is not war, but rather the complete, verifiable and irreversible denuclearization of the Korean peninsula."

Music from both sides -- propaganda songs from the North, and K-pop from the South -- was audible as he spoke.

North Korea has been a particular thorn in the side of US President Donald Trump's administration, with the regime claiming advances in its nuclear weapon and missile program and its continued threats and provocations putting the US and its Asian allies on high alert.

Mattis' trip to the region comes ahead of Trump's visit to Asia next week. Trump will most likely forgo a visit to the heavily fortified border between North and South Korea when he visits Asia, a senior White House official said earlier this week , bypassing what has been a symbolic opportunity for US commanders-in-chief to stare into the Hermit Kingdom.

North Korean soldiers (L) look at the South side while US Secretary of Defence Jim Mattis and South Korean Defence Minister Song Young-Moo visit at the truce village of Panmunjom in the Demilitarized Zone (DMZ) on the border between North and South Korea on October 27, 2017.

Rift?

Mattis also met with South Korean President Moon Jae-in at the Blue House, the Asian nation's presidential residence.

During the hour-long meeting, Moon said a strong defense was of primary importance for the "security and peace of the Korean peninsula"

He said the two nations were "cooperating closer than ever along with the international community" but needed to "strengthen" their North Korea deterrence ability.

South Korean president Moon Jae-in meets with US Defense Secretary James Mattis on Friday, 27th October, 2017.

There had been fears of a rift between Trump, who has taken a more aggressive stance towards North Korea, and his South Korean counterpart Moon, who has pressed for negotiations with Pyongyang in an attempt to tamp down rapidly heightening tensions.

In September, Trump tweeted "South Korea is finding, as I have told them, that their talk of appeasement with North Korea will not work, they only understand one thing!" he wrote. He didn't specify what the "one thing" was, but has suggested in the past that shows of military force are necessary to halt the country's progress toward nuclear armament.

Mattis' visit to South Korea comes as two Democrats introduced bipartisan legislation designed to prevent Trump attacking North Korea without the approval of Congress.

Sponsored by Rep. John Conyers, Jr. and Sen. Edward J. Markey, the "No Unconstitutional Strike Against North Korea Act of 2017", if passed, would restrict the funds available to government agencies from "being used to launch a military strike against North Korea without the prior approval of Congress or the imperative to respond to an attack against the United States or its allies."

The Congressmen led 60 members of the House and Senate in introducing the bill, a statement on Conyers' website says. It adds that "more that two-thirds" of Americans think that the US should only attack North Korea in retaliation, not as a first strike.

Military back-up

Speaking to US and South Korean troops at Yongsan garrison following his return from the DMZ, Mattis said that while the US and South Korea were "doing everything" possible to reach a diplomatic solution, the combined military presence was key to the strategy.

"Ultimately our diplomats have to be backed up by strong soldiers, sailors, airmen and marines," he said in impromptu remarks.

"So they speak from a position of strength, of combined strength, of alliance strength. Shoulder to shoulder, (South Korea) and the US together.

US Secretary of Defense James Mattis meets US and South Korean troops at Yongsan garrison in Seoul, South Korea.

"You just keep working together and show the world we can do it and we'll buy time for our diplomats to solve this problem, OK?"

At the heavily-guarded DMZ, Mattis visited Observation Post Ouellette, accompanied by US and South Korean Joint Security Area Commanders Lt. Col. Matthew Farmer and Lt. Col. Kwon Young-hwan, before moving to the Freedom House at Panjunmon Village, near the military line of demarcation which separates the two neighbors and rivals.

South Korean Minister of Defense Song Young-moo showed Mattis the North Korean units stationed north of the 38th parallel and said that he felt "a defensive operation" against the number of units was "unfeasible."

Asia tour

Earlier on Friday, Mattis visited two US military installations, Osan airbase and the Yongsan garrison in Seoul.

The secretary had come to South Korea from Thailand, where he attended the funeral of former King Bhumibol Adulyadej

US Vice President Mike Pence visited the DMZ in April, describing it as the "frontier of freedom."

Coming shortly after a failed North Korean missile test, Pence said at the time that the "era of strategic patience is over."

US Secretary of Defence Jim Mattis (L) shakes hands with South Korean Defence Minister Song Young-Moo (R) as they visit the truce village of Panmunjom in the Demilitarized Zone (DMZ) on the border between North and South Korea on October 27, 2017.

The DMZ is the de facto border between North and South Korea. It's four kilometers (2.5 miles) wide, stretches 250 kilometers (160 miles) and is dotted with military guard posts, mines and defensive structures.

It was established by the 1953 armistice agreement which ended the Korean War, though both sides technically remain at conflict as no peace treaty has ever been signed.