Updated

Defense Secretary Jim Mattis said in no uncertain terms Saturday that North Korea presented a "clear and present danger," while also criticizing China for ratcheting up the tension over contested islands in the South China Sea.

His sharp words for both countries suggested he believed China would, out of self-interest, pressure North Korea to halt its nuclear and missile programs even as Washington pushes Beijing to change course in the South China Sea.

Speaking at an international security conference in Singapore, Mattis said the Trump administration was encouraged by China's renewed commitment to working with the U.S. and others to rid North Korea of its nuclear weapons. He also said he thought Beijing ultimately would see Kim Jong Un's regime as a liability rather than an asset.

He was, however, unrelentingly critical of North Korea, a politically and economically isolated nation whose leaders have long viewed the United States as a military threat, in part because of periodic U.S. military exercises with South Korea, which the rogue nation sees as preparations for attacks aimed at destroying its ruling elite.

Mattis called North Korea an "urgent military threat." In a question-and-answer session with his audience of national security experts from across the globe, he was asked whether the U.S. might attack the North pre-emptively and without warning South Korea in advance.

"We're working diplomatically, economically, we're trying to exhaust all possible alternatives to avert this race for a nuclear weapon in violation of ... the United Nations' restrictions on North Korea's activities," he said. "We want to stop this. We consider it urgent."

China blocked tough new sanctions against North Korea that the United States pushed in the U.N. Security Council on Friday. However, the Security Council did vote unanimously to add 15 individuals and four entities linked to the North's nuclear and missile programs to a U.N. sanctions blacklist.

Still, Mattis said the U.S. was fully committed to working with its global partners, Reuters reported. "Like it or not, we are a part of the world...What a crummy world if we all retreat inside our borders," he replied.

In his speech to the Shangri-La Dialogue, sponsored by the International Institute for Strategic Studies, Mattis sought to balance his hopeful comments on China with sharp criticism of what he called Beijing's disregard for international law by its "indisputable militarization" of artificial islands in disputed areas of the South China Sea.

"We oppose countries militarizing artificial islands and enforcing excessive maritime claims unsupported by international law," he said. "We cannot and will not accept unilateral, coercive changes to the status quo."

Rep. Mac Thornberry, a Republican from Texas and chairman of the House Armed Services Committee, told a news conference later that he believed Mattis had effectively stressed the U.S. commitment to allies in the Asia-Pacific region.

"He was very clear, very strong," said Thornberry, who led a bipartisan congressional delegation on an Asia tour and attended Saturday's Singapore conference.

Overall, Mattis' speech struck a positive, hopeful tone for cooperation and peace in the Asia-Pacific region, where he and his predecessors have made it a priority to nurture and strengthen alliances and partnerships.

"While competition between the U.S. and China, the world's two largest economies, is bound to occur, conflict is not inevitable," he said. "Our two countries can and do cooperate for mutual benefit. We will pledge to work closely with China where we share common cause.

"While the North Korean regime has a long record of murder of diplomats, of kidnapping, killing of sailors and criminal activity, its nuclear weapons program is maturing as a threat to all," Mattis said. "As a matter of national security, the United States regards the threat from North Korea as a clear and present danger."

The U.S. has about 28,500 troops permanently based in South Korea, a defense treaty ally.

The Associated Press contributed to this report.