Homeland Security Secretary John F. Kelly, shown testifying before a Senate subcommittee in May 2017, spoke in an interview in Mexico City on July 7, 2017, about the Trump administration’s enforcement of U.S. immigration laws. (Matt McClain/The Washington Post)

Homeland Security Secretary John F. Kelly on Friday defended the Trump administration’s policy of targeting immigrant families that pay to bring their children up from Central America, saying that the United States is finally “enforcing the law” on illegal immigration in that and other ways.

During an interview at the conclusion of a three-day visit to Mexico, Kelly described the migration flow, which has sent hundreds of thousands of people north to the United States in recent years, as an “overwhelmingly economic” phenomenon rather than a matter of people fleeing violence, as many in Central America insist.

Immigration and Customs Enforcement agents have focused on detaining and deporting people with criminal records, he said, despite allegations from the Mexican government and others about a wider crackdown. But they have also begun arresting people who pay smugglers to bring their children or other young relatives into the country.

“If they do have family in the United States that then says, ‘We’ll take them and sponsor them,’ we’re going to look at the family,” Kelly said of youngsters apprehended at the border. “If the family is illegal in the United States and we can make the case, which I think is very easy to make, that they were part of this human-smuggling process, then they broke the law. And we’ll take the appropriate measures.”

President Trump’s executive orders and harsh rhetoric on immigration have alarmed many immigrants and their advocates. While deportations are roughly similar to levels under the Obama administration, the number of arrests of undocumented immigrants has risen sharply under Trump.

[Fact Checker: Trump’s claim that illegal immigration is down 64% because of his administration]

Mexican officials have grown increasingly concerned about who is being deported from the United States and raised that issue with Kelly during his visit. The Mexican government, through its embassy in Washington, has compiled a list of deportees who may have been “subject to a violation of due process” and are looking for relief from the U.S. government, said Carlos Sada, a deputy foreign minister in charge of North American affairs.

“These cases are something where the law has been applied dramatically,” Sada said in an interview.

Sada said that ICE agents are applying the law more strictly than in the past and that they should use more “flexibility,” particularly in cases of immigrants who have lived for years in the United States, have children, are not violent and do not pose a threat to the country.

Kelly, in the interview, said that ICE “doesn’t do sweeps, doesn’t do roadblocks, doesn’t do raids into places of employment where they round everyone up and check on them.”

But in the course of an arrest, an agent can ask other people in the vicinity about their immigration status and detain those people, Kelly said.

“We much prefer to do these in jails, but since many jails don’t cooperate with us, then we have to do this in neighborhoods,” he said.

The other population of deportees, he said, consists of people who have gone through the immigration court process and been ordered to leave the country.

“These are court-ordered deportations,” he said. “I get a lot of calls from members of Congress on individual cases. What I say to them is: ‘I’ve got a court order. I can’t ignore it.’ ”

“I’m going after the people who have broken U.S. law, in addition to being in the United States illegally,” he said. “So when members of Congress and others threaten me and chastise me for not using my discretion, I am.”

Kelly said that under the Trump administration, about 45,000 people of Mexican descent have been detained in the United States but that the Mexican government has called to question only a “handful” of the cases.

Before Trump’s private meeting with Mexican President Enrique Peña Nieto at the Group of 20 summit Friday in Hamburg, Trump told reporters that he “absolutely” still wants Mexico to pay for his proposed border wall. Kelly said that in his discussions with Mexican officials since Wednesday, “we didn’t once talk about the wall.”

Kelly — who was accompanied for parts of his visit here by CIA Director Mike Pompeo and Sen. Tom Cotton (R-Ark.), a member of the Senate Intelligence Committee — held a number of meetings with top Mexican officials, including Peña Nieto and Foreign Minister Luis Videgaray.

On Thursday, Kelly met with the leaders of Mexico’s army and navy at a military base in Acapulco, which has been the deadliest Mexican city for several years running. On the same morning as his visit, a prison riot in Acapulco left 28 people dead, several of them beheaded, according to Mexican officials.

Along with the Mexican military leaders, Kelly flew to the opium poppy fields of Guerrero and watched as Mexican soldiers burned crops. Guerrero produces more than half of Mexico’s poppy and supplies much of the heroin consumed in the United States. Kelly described the U.S. opioid epidemic — in which some 60,000 people died last year — as a crisis that needs more attention.

“We should be ashamed of ourselves at not having gotten our arms around this problem,” he said.

Read more:

Texas is getting a new ‘sanctuary cities’ law, and the Mexican government isn’t happy

House GOP backs bills to crack down on illegal immigration

Feds will now target relatives who smuggled in children

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news