U.S. President Donald Trump has signed a congressional bill to avert another government shutdown and has declared a national emergency to fulfil his pledge to construct a wall along the U.S.-Mexico border.

Press secretary Sarah Sanders said Trump signed the bill at the White House on Friday. The legislation gives Trump 55 additional miles (90 kilometres) of border fencing, well short of the 200-plus miles he wanted.

Trump has also declared a national emergency at the southern border and is using his executive authority to go around Congress to obtain more funds to build a wall.

Trump said he had to call on the military for assistance "because of the gravity of the current emergency situation."

"The current situation at the southern border presents a border security and humanitarian crisis that threatens core national security interests and constitutes a national emergency," Trump said in a proclamation.

The move is drawing bipartisan criticism on Capitol Hill and expected to face rounds of legal challenges.

Trump spoke Friday from the Rose Garden at the White House, and claimed illegal immigration is "an invasion of our country."

The two top Democrats in Congress said they'll use "every remedy available" to oppose the declaration.

House Speaker Nancy Pelosi and Senate minority leader Chuck Schumer said Friday they'll take action "in the Congress, in the courts and in the public."

Of course it’s a national emergency.<br><br>-Largest fentanyl bust in history, enough to kill 57 million Americans<br>-The caravans keep coming<br>-Angel families losing loved ones to violent criminals<br><br>What will it take for the Left to acknowledge the crisis on our border? <a href="https://twitter.com/hashtag/DoWhatWeSaid?src=hash&ref_src=twsrc%5Etfw">#DoWhatWeSaid</a> —@Jim_Jordan

"This is plainly a power grab by a disappointed president, who has gone outside the bounds of the law to try to get what he failed to achieve in the constitutional legislative process."

California's top officials said they will probably sue President Trump over his emergency declaration.

Speaking Friday in the state capital, Attorney General Xavier Becerra said there is no emergency at the border and that Trump doesn't have the authority to make the declaration.

California has repeatedly challenged Trump in court. Becerra has filed at least 45 lawsuits against the administration.

Hoping for a 'fair shake' in the courts

Shortly before Trump spoke, the U.S. Chamber of Commerce — a reliable supporter of Republicans in recent decades — used social media to urge the president to refrain from declaring a national emergency, saying it "will create a dangerous precedent" and threatens "to usurp the powers of Congress."

Trump admitted the decision will be challenged and work its way through the courts, including up to the U.S. Supreme Court.

"Hopefully we'll get a fair shake," he said.

In a rare show of bipartisanship, lawmakers voted Thursday to fund large swaths of the government and avoid a repeat of the recent, debilitating five-week government shutdown. The money in the bill for border barriers, about $1.4 billion US, is far below the $5.7 billion US Trump insisted he needed and would finance just a quarter of the 322 kilometres he wanted this year.

The Senate passed the legislation 83-16 Thursday, with both parties solidly aboard. The House followed with a 300-128 tally.

To bridge the gap, the White House earlier Friday said Trump will be spending roughly $8 billion US on border barriers — combining the money approved by Congress with funding he plans to repurpose through executive actions, including the national emergency. The money is expected to come from funds targeted for military construction and counter-drug efforts, but aides could not immediately specify which military projects would be affected.

Watch as Trump talks about where he gets his data on border issues:

In a terse exchange with a reporter, U.S. President Donald Trump is asked to clarify where he gets his numbers on border crossings, drugs and violence at the U.S.-Mexico border. 1:44

The contents of Trump's speech on Friday echoed appeals he made during the 35-day partial government shutdown, including a prime-time address from the White House that was televised on most networks.

Stats about drug seizures 'just a lie': Trump

Trump sparked the last partial shutdown before Christmas after Democrats snubbed his $5.7-billion US demand for the wall. The closure denied paycheques to 800,000 federal wokers, harmed contractors and people reliant on government services, and was loathed by the public.

But Trump seemed to go further at times, challenging the government's own data that the majority of drugs crossing from the southern border do so at ports of entry.

"It's just a lie," Trump said of those claims, and he seemed to express admiration for China's use of capital punishment for drug offenders.

When challenged by a reporter to provide sources for his counterclaim, Trump said, "I get my numbers from a lot of sources … like Homeland Security, primarily."

Watch as Aaron Blake of the Washington Post discusses Trump's proclamation:

Trump makes declaration of emergency despite data that says otherwise 2:34

Trump also seemed to doubt the statistics from U.S. customs officials indicating that illegal crossing apprehensions are a fraction of their total in the 1990s and early this century. Later, he said the numbers were only going down because of the work of his administration, seemingly undercutting his rationale for an emergency.

Despite widespread opposition in Congress to proclaiming an emergency, including by some Republicans, Trump was responding to pressure to act unilaterally to soothe his conservative base and avoid appearing as if he's lost his wall battle.

Trump expressed admiration for conservative commentators Sean Hannity, Ann Coulter and Rush Limbaugh, but said they don't determine White House policy.

Emergency declarations usually narrowly defined

Even if his emergency declaration withstands challenge, Trump is still billions of dollars short of his overall funding needed to build the wall as he promised in 2016. After two years of effort, Trump has not added any new border mileage; all the construction so far has gone to replacing and repairing existing structures. Ground is expected to be broken in South Texas soon on the first new mileage.

The White House said Trump would not try to redirect federal disaster aid to the wall, a proposal they had considered but rejected over fears of a political blowback.

The National Emergencies Act was passed by Congress in 1976 and has been used dozens of time since by presidents from both parties, but usually for narrowly defined cases.

Central American immigrants line up to register with Mexican Immigration officials at a shelter in Piedras Negras, Mexico, on Feb. 5. They are part of the latest caravan of migrants, camped in Piedras Negras, just west of Eagle Pass, Texas. (Jerry Lara/The San Antonio Express-News via AP)

Emergency declarations by former presidents Barack Obama, George W. Bush and Bill Clinton were overwhelmingly for the purpose of addressing crises that emerged abroad. Many blocked foreign interests or terrorist-linked entities from access to funds. Some prohibited certain imports from or investments to countries associated with human rights abuses.

A list compiled by the Brennan Center said Clinton declared 17 national emergencies, Bush 13 and Obama 12.

As a private citizen, Trump often railed on social media when Obama signed executive orders and didn't work with Congress.

Our CEO Tom Donohue’s statement on the president’s intent to sign a national emergency declaration: <a href="https://t.co/pywKKPlGwq">https://t.co/pywKKPlGwq</a> <a href="https://t.co/6lPW0TebVE">pic.twitter.com/6lPW0TebVE</a> —@USChamber

The situation at the border has been a prime focus of the administration. Alarmed by migrant caravans making their way toward the U.S. from Central America, Trump has ordered thousands of military troops to report to border areas, though they're legally prevented from directly interacting with migrants.

The administration, in response to those who cross at the ports of entry, undertook the controversial policy of separating adults from children in many of those instances, and officials have admitted in congressional testimony that oversight and tracking of those who were separated, or a framework for how to reunite them, was lacking.

The U.S. has also convinced Mexico, albeit in limited circumstances, to allow migrants making asylum claims to wait out the delay in adjudicating their cases south of the border.