A recent surge in arrests along the Mexico border has been partly driven by soaring numbers of migrants trying to enter the United States again and again, as emergency pandemic measures that rapidly “expel” most detainees have had the unintended consequence of allowing them to try repeat illegal crossings, according to two Department of Homeland Security officials with knowledge of the unpublished statistics.

U.S. Customs and Border Protection said last week that the agency recorded 40,746 detentions in July, up 24 percent from June and more than double the figure from April, when 17,086 were taken into custody. Since implementing the emergency measures, CBP officials have not publicly disclosed the Border Patrol “recidivism rate” — the percentage of those detentions that involves repeat crossers — but the two DHS officials said the figure now exceeds 30 percent. That is up from 7 percent last year.

In late March, as the novel coronavirus spread, the Trump administration began allowing agents to quickly process migrants and bus them directly back to Mexico, instead of holding them in detention cells where infections could multiply. More than 90 percent of those arrested by CBP are now summarily “expelled” from the country under the emergency measures, including minors, asylum seekers and others normally afforded additional protections.

Migration levels fell sharply in April after the measures were implemented, but crossings have jumped since then. U.S. officials expect the trend to continue as economic conditions deteriorate in Mexico and Central America because of the pandemic. The expulsion system affords migrants multiple attempts to be caught with little risk of detention or prosecution, and officials said they worry that the recidivism rate will grow.

“Without a deterrent, repeat entries continue,” said one official familiar with the statistics who was not authorized to discuss them publicly.

Under normal circumstances, migrants who repeatedly try to cross can be charged with a felony and prosecuted in federal court, sometimes spending months in U.S. jails before they are deported. Border officials insist that the prosecutions are an effective deterrent and discourage migrants from trying again and again in hopes of succeeding.

But with federal courts partly shut down during the pandemic, prosecutions have plunged. “No consequences,” said another DHS official familiar with the statistics.

There is no indication that CBP officials plan to scrap the expulsion measures, which they say are essential to protecting officers, agents and other migrants from exposure to the virus, and to avoid outbreaks in Border Patrol stations. Ten CBP employees have died as a result of contracting the virus, acting commissioner Mark Morgan told reporters last week. He faulted migrants for disregarding public health officials’ stay-at-home guidelines.

The latest CBP figures show that nearly 80 percent of those detained last month were single adults, and Mexican nationals have again surpassed Central Americans as the largest demographic group.

President Trump is citing his immigration record as part of his reelection pitch, and he has touted the emergency border measures as a major success. Immigrant advocates and critics of the president say the United States has closed the door to victims of persecution and migrants fleeing gangs and abusers, deporting them at the risk of serious harm.

Despite the increases of the past three months, arrests along the border remain far below 2019 levels, when nearly 1 million migrants were taken into custody during a surge of families and children from Central America.