Media playback is unsupported on your device Media caption Trump: 'I've signed the order - now we'll be sued'

President Trump faces legal challenges to his decision to use emergency powers to build a wall on the US border with Mexico.

California and New York said they would take legal action to challenge his move to bypass Congress and secure funding for the project.

Building the wall was a key pledge of Mr Trump's campaign.

Democrats said it was a "gross abuse of power" and vowed to contest it "using every remedy available".

On Friday, Mr Trump signed the emergency declaration along with a spending bill aimed at preventing a repeat of a recent government shutdown.

Declaring an emergency could give him access to billions of dollars. Mr Trump announced the plan after Congress refused funding for the wall.

Within hours, the first legal challenge against the declaration of national emergency was launched.

A liberal advocacy group, Public Citizen, sued on behalf of a nature reserve and three Texas landowners who have been told the wall may be constructed on their properties.

How have Democrats responded?

Governor Gavin Newsom of California dismissed the president's decision as "political theatre".

"He's been embarrassed, and his base needs to be fed," he told reporters.

"Fortunately, Donald Trump is not the last word. The courts will be the last word," he added.

New York state's Democratic attorney general, Letitia James, said the state would not "stand for this abuse of power and will fight back with every legal tool at our disposal."

Image copyright Getty Images Image caption Democrats have described the national emergency as "made up"

The American Civil Liberties Union (ACLU) said it would file a lawsuit in the coming days to curb "this blatantly illegal executive action".

On Friday the two most senior Democrats - House of Representatives Speaker Nancy Pelosi and Senate Democrat leader Chuck Schumer - said they would challenge the "power grab by a disappointed president" in Congress and in the courts.

Ms Pelosi also seized on a remark by Mr Trump in response to a question from a reporter, in which he said he "didn't need to do this".

Analysts suggest that this remark could undermine Mr Trump's case that the country is facing an emergency.

What did Mr Trump say?

Making the announcement in the White House Rose Garden, the president said the emergency would allow him to get almost $8bn for the wall.

This is still considerably short of the estimated $23bn cost of the wall along almost 2,000 miles (3,200km) of border.

Mr Trump accepted that he would be sued for the move, and predicted that the emergency order would lead to legal action which was likely to end up in the Supreme Court.

Media playback is unsupported on your device Media caption Senator McConnell supports the president; Speaker Pelosi warns it sets a dangerous precedent

"We're going to confront the national security crisis on our southern border," he said.

"Everyone knows that walls work."

Later, Mick Mulvaney, the acting White House chief of staff, told reporters that Mr Trump's move "creates zero precedent".

"This is authority given to the president in law already. It's not as if he just didn't get what he wanted so he's waving a magic wand and taking a bunch of money," he said.

Dangerous precedent

By Jon Sopel, BBC North America editor

The trouble with going nuclear is there is fall-out. This has been presented as a predictably partisan issue.

On one side of the wall, Republicans; on the other side Democrats. But by going nuclear the president has made it more complicated than that. There are a lot of Republicans - in the Senate and in the House - deeply uneasy about what Mr Trump is doing.

Why? Because the constitutional arrangement of the US is that Congress - not the president - controls the purse strings and allocates funds.

This is a major land grab by the president. It undermines their position and sets a very dangerous precedent.

Can Congress stop Trump's emergency move?

The National Emergencies Act contains a clause that allows Congress to terminate the emergency status if both houses vote for it - and the president does not veto.

With a comfortable majority in the House, Democrats could pass such a resolution to the Senate. The Republicans control the Senate, but a number of Republican senators have been vocal in their unease about the president invoking a national emergency.

The dissenting Republicans include 2012 presidential contender and new senator for Utah Mitt Romney, Florida senator Marco Rubio, and the senator from Maine Susan Collins, who said the move was of "dubious constitutionality".

The resolution would however still require Mr Trump's signature to pass, allowing him to veto it. A supermajority in both houses of Congress is needed to overturn a presidential veto.

What is a national emergency?

The National Emergencies Act is intended for times of national crisis. Mr Trump has claimed that there is a migration crisis at the nation's southern border - a claim strongly refuted by migration experts.

The largest number of illegal migrants settling in the US each year is those who stay in the country after their visas expire.

Declaring a national emergency would give the president access to special powers that effectively allow him to bypass the usual political process, and he would be able to divert money from existing military or disaster relief budgets to pay for the wall.

Emergency declarations by previous presidents have been overwhelmingly used for addressing foreign policy crises - including blocking terrorism-linked entities from accessing funds or prohibiting investment in nations associated with human rights abuses.

Where will the money come from?

On Friday, Mr Mulvaney said the $8bn would be made up of:

$1.4bn from the agreed budget

$600m from cash and assets seized from drug traffickers

$2.5bn from a defence department anti-drug trafficking fund

$3.5bn reallocated from military construction projects

The latter is the biggest amount and the relevant statute allows a president to divert funds for projects that "require use of the armed forces". This is almost certain to bring a legal challenge.

A congressional aide told ABC News projects that could be cancelled include constructions at Guantanamo Bay, a military school in Japan and special forces facilities in North Carolina.

Poor living conditions for military families have become a concern but a Pentagon spokesman, Bill Speaks, insisted "military family-housing projects will not be affected".

Trump officials also said that projects affecting force-readiness would not be compromised.

Mr Trump said military officials had told him the wall was more important and that what he was told would be cut "didn't sound too important to me".