By Thursday, Mexican officials had indicated a willingness to consider the changes, the administration official said, though he cautioned that lawyers for the countries involved were still scheduled to meet throughout the day and into the evening to see if an agreement could be reached.

It remains unclear whether an agreement focused on more robust enforcement and changes to the region’s asylum laws would reduce the flow of migrants enough for Mr. Trump. In a series of tweets and remarks over the past week, Mr. Trump vowed to impose a series of escalating tariffs on Mexican imports unless Mexico could end the surge of migrants, especially those from Central America, pressing to cross the border. It was a problem, he said, that Mexicans could solve “in one day if they so desired.”

That demand from Mr. Trump loomed over the talks Mr. Pence and Mr. Pompeo had Wednesday with Marcelo Ebrard, the Mexican foreign minister, according to a senior administration official familiar with the discussions in the Roosevelt Room at the White House.

But diplomats on both sides of the border and immigration experts say the president’s demand for a total end to illegal immigration is fanciful. Most of those experts agree that Mexico could step up enforcement and provide more humanitarian relief to migrants, but say stopping all illegal immigration into the United States is next to impossible.

“It shows a basic misunderstanding about the patterns of migration,” said Kevin Appleby, a veteran of Washington’s immigration wars over two decades. “The Mexican government could take some steps. But there are going to be ways that migrants get to our border regardless of what the Mexicans do.”

Hoping to mollify Mr. Trump, Mr. Ebrard said during Wednesday’s meeting that his government was willing to step up enforcement at the border between Mexico and Guatemala, where many of the Central American migrants begin their journey through Mexico to the United States border.

He also told Mr. Pence and Mr. Pompeo that President Andrés Manuel López Obrador of Mexico is committed to cracking down on transnational gangs who make money by regularly trafficking migrants through Mexico, according to the American official. Mr. Ebrard also promised that the Mexican government would offer asylum to thousands of Central American migrants who might otherwise seek protection in the United States.