WASHINGTON — As migrants surge at the U.S.-Mexico border, President Joe Biden’s administration has been caught on its heels and is now scrambling to manage a humanitarian and political challenge that threatens to overshadow its ambitious agenda.

Administration officials say Biden inherited an untenable situation that resulted from what they say was President Donald Trump’s undermining and weakening of the immigration system.

But with Congress pivoting to taking up immigration legislation, images and stories from the border have begun to dominate the headlines, distracting from the White House’s efforts to promote the recently passed $1.9 trillion COVID-19 relief bill.

The White House dispatched Homeland Security Secretary Alejandro Mayorkas to four Sunday news shows in an effort to stress that it was working to get things under control.

“Our message has been straightforward — the border is closed,” Mayorkas said. “We are expelling families. We are expelling single adults. And we’ve made a decision that we will not expel young, vulnerable children.”

The White House has steadfastly refused to call the situation a “crisis,” leading to a Washington battle over the appropriate description of the tense situation. Career immigration officials had warned there could be a surge after the November election and the news that Trump’s hard-line policies were being reversed.

In the first days of his term, Biden acted to undo some of Trump’s measures, a rollback interpreted by some as a signal to travel to the United States. While the new administration was working on immigration legislation to address long-term problems, it didn’t have an on-the-ground plan to manage a surge of migrants.

“We have seen large numbers of migration in the past. We know how to address it. We have a plan. We are executing on our plan and we will succeed,” Mayorkas said. But, he added, “it takes time” and is “especially challenging and difficult now” because of the Trump administration’s moves. “So we are rebuilding the system as we address the needs of vulnerable children who arrived at our borders.”

Biden officials have done away with the “kids in cages” imagery that defined the Trump family separation policy but have struggled with creating the needed capacity to deal with the surge. Unaccompanied children and teenagers in Customs and Border Protection custody must be transferred to the care of Health and Human Services within three days, although the minors coming now are being held for days longer than that.

Officials are trying to build up capacity to care for some 14,000 migrants now in federal custody — and more likely on the way. Critics say the administration should have been better prepared.

“I haven’t seen a plan,” said Rep. Michael McCaul, R-Texas. “They have created a humanitarian crisis down here at this border that you have seen now. And the reason why they are coming is because he says words do matter, and they do. The messaging is that if you want to come, you can stay.”

The administration also has been pressed as to why it will not allow media to see the facilities at the border. Mayorkas said the government was “working on providing access so that individuals will be able to see what the conditions in a Border Patrol station are like.”

Since Biden’s inauguration on Jan. 20, the U.S. has seen a dramatic spike in the number of people encountered by border officials. There were 18,945 family members and 9,297 unaccompanied children encountered in February — an increase of 168% and 63%, respectively, from the month before, according to the Pew Research Center. That creates an enormous logistical challenge because children, in particular, require higher standards of care and coordination across agencies.

Among the reasons for the surge: thousands of Central American migrants already stuck at the border for months and the persistent scourge of gang violence afflicting Northern Triangle countries — Guatemala, Honduras and El Salvador.