As three aircraft carrier strike groups head towards the Korean Peninsula, state media denounces US 'muscle-flexing'.

North Korea needs nuclear weapons as a deterrent to prevent "invasion and plunder" by the United States, Pyongyang's official media says.

The online commentary on Wednesday by the Uriminzokkiri website, part of the Korean Central News Agency, also condemned the US and its allies' "crazy escalation of sanctions, pressure, and military threats" against the communist country that "will get them nowhere".

"The nuclear force of the DPRK has become a strong deterrent for firmly protecting peace and security of the Korean Peninsula and the rest of Northeast Asia and creditably guaranteeing the sovereignty and the rights to existence and development of the Korean nation," it said, using the acronym for the country's official name, Democratic People's Republic of Korea.

North Korea is developing its nuclear weapons so it doesn't endure "the tragic situation of the war-torn non-nuclear countries which became the targets of invasion and plunder by the US", it added.

The comments come ahead of US President Donald Trump's two-week visit to the Asia-Pacific region starting on Friday, where the threat of a military confrontation with North Korea will be high on the agenda in Japan, South Korea, and China.

Tensions remain sky high after the North's sixth and most powerful underground nuclear test in September, and flurry of ballistic missile tests in recent months.

In response, Kim Jong-un's leadership said it may conduct an atmospheric nuclear weapons test.

Ahead of Trump's visit, three American aircraft carrier strike groups have been deployed to the region, a move military analysts have described as unusual.

Stratfor, a US-based intelligence analysis company, noted in a report on Tuesday that the US Air Force also will send a dozen F-35A stealth fighter jets to a base in Japan in early November.

"The gathering is a rare occurrence - the last time three US aircraft carrier strike groups convened for a combined exercise was in 2007 - and will give the United States a powerful force within striking distance of North Korea," Statfor said.

"Taken together, these developments suggest that the United States is preparing for a confrontation. But that doesn't necessarily mean that Washington is gearing up to start a war with Pyongyang," the report concluded.

Michael T Clare, a professor of peace and world-security studies at Hampshire College in the US, wrote on Wednesday in The Nation: "There can be only two plausible explanations for this extraordinary naval buildup: to provide Trump with the sort of military extravaganza he seems to enjoy; and/or to prepare for a pre-emptive military strike on North Korea."

The Uriminzokkiri commentary denounced the military build-up near North Korea.

"It is ridiculous for the US to try to browbeat the DPRK through such muscle-flexing as deploying nuclear aircraft carriers and submarines near the Korean Peninsula and its vicinity and flying nuclear-capable strategic bombers on it," it said.