Media playback is unsupported on your device Media caption Mr Mattis said China and Russia posed a major threat to US security

US Defence Secretary James Mattis has said competition between great powers, not terrorism, is now the main focus of America's national security.

The US faced "growing threats from revisionist powers as different as China and Russia", he said, unveiling the national defence strategy.

In an apparent reference to Russia, he warned against "threaten[ing] America's experiment in democracy".

"If you challenge us, it will be your longest and worst day," he warned.

America has been gripped by ongoing investigations into alleged collusion between the Trump 2016 election campaign and Russia.

Speaking in Washington, Mr Mattis also appealed to Congress to fund the military adequately and refrain from "indiscriminate and automatic cuts" to the US federal budget.

President Donald Trump is seeking to boost defence spending by 10%, or $54bn (£43bn), in his proposed budget plan for this year, and hopes to recoup that sum through deep cuts elsewhere, including to foreign aid.

America's competitive edge 'fast eroding'

By Jonathan Marcus, BBC defence and diplomatic correspondent

The publication of the Trump administration's new National Defense Strategy signals an important shift in Washington's priorities.

For almost two decades - ever since the attacks of 9/11 - America's military focus has been on fighting terrorism, with counter-insurgency campaigns in Afghanistan, Iraq and Syria.

But now there is to be a renewed emphasis on inter-state strategic competition - matching so-called peer competitors like Russia and China.

US Defence Secretary James Mattis is right when he says that Washington's competitive military edge is fast eroding. There needs to be investment in a range of new technologies that might provide the edge on a future battlefield.

But it is not simply a matter of spending more money. He pointed to the difficulty of passing budgets on Capitol Hill over successive years which, he said, had done more damage to US military readiness than any enemy in the field.

How much have US defence priorities changed?

Media playback is unsupported on your device Media caption US-backed forces may be celebrating, but IS has not been defeated

This is the first time the defence policies of the Trump administration have been spelled out in one place.

The threats listed are the same as under the Obama administration but the order of priority is different.

Formerly, jihadist militant groups like Islamic State or al-Qaeda were the focus but latterly America's former Cold War opponents, Russia and China, have reasserted themselves strategically.

"We face growing threats from revisionist powers as different as China and Russia, nations that seek to create a world consistent with their authoritarian models," Mr Mattis said.

A summary of the new strategy was published on the defence department's website.

How big a threat to America are Russia and China?

The three great nuclear powers have posed a permanent existential threat to each other since Cold War days.

Media playback is unsupported on your device Media caption Russia invited international journalists to report on their operations in Syria

In recent years, however, fears have risen of the once-unthinkable: a direct conventional clash, particularly between Russia and the US in Syria or Ukraine.

Media playback is unsupported on your device Media caption What will China use their new aircraft carrier for?

The new strategy recognises that "China and Russia in particular have been assiduously working over a number of years to develop their military capabilities to challenge our military advantages", said Elbridge Colby, US deputy assistant secretary of defence for strategy and force development.

"This strategy really represents a fundamental shift to say, look, we have to get back, in a sense, to the basics of the potential for war and this strategy says the focus will be on prioritising preparedness for war, in particular major power war," he added.

What pitch for funding did Mr Mattis make?

The national defence strategy provides guidance for the 2019 defence budget.

While the US was "still strong", the defence secretary said, its competitive edge had "eroded in every domain of warfare - air, land, sea, space and cyberspace - and is continually eroding".

Appealing to Congress, he said: "No strategy can survive without predictable funding. As hard as the last 16 years [that is, since the 9/11 attacks] have been, no enemy has harmed the US military more than defence spending caps and sequestration."

Referring to the current wrangle in the Senate over a bill to fund federal agencies temporarily, he said a shutdown would have an impact on military operations.

Image copyright Reuters Image caption Aircraft carriers project US military power across the globe

"Our maintenance activities will probably pretty much shut down...over 50%, altogether of my civilian workforce will be furloughed..." he said.

"We do a lot of intelligence operations around the world and they cost money, those obviously would stop."