U.S. President Donald Trump talks to reporters as he departs for a visit to the U.S. southern border area in Texas from the White House in Washington, U.S., January 10, 2019. REUTERS/Carlos Barria

WASHINGTON (Reuters) - U.S. President Donald Trump said on Thursday he was likely to declare a national emergency to secure funds for his long-sought wall along the U.S. southern border if he cannot reach an agreement with Democrats in Congress to provide the money.

Speaking to reporters at the White House as he prepared to depart to visit the Texas border town of McAllen on the 20th day of a partial government shutdown, Trump repeated his contention that he had the right to declare a national emergency over immigration.

Trump has held out for $5.7 billion in partial wall funding in talks with congressional leaders, but Democrats have held steadfast in their opposition to providing any money for a border wall.

The dispute led to a shutdown of about one-quarter of U.S. federal agencies when funding ran dry late last year.

If Trump were to declare an emergency in an effort to redirect funds Congress has approved for other purposes, it likely would lead to quick challenges in the courts.