Illegal immigration across the southwest border has doubled in the last four months, according to new government data that suggests the early gains of President Trump’s tenure are wearing off.

More than 30,000 illegal immigrants were nabbed in August, up 22 percent compared to July and up nearly 100 percent compared to April, when fewer than 16,000 illegal immigrants were arrested by the Border Patrol or stopped at ports of entry by Customs and Border Protection (CBP) officers.

The numbers are still lower than they were a year before under Mr. Obama, but the gains Mr. Trump made in his first months in office are dissipating.

Officials say the number of people caught is a rough yardstick for the total flow, so more apprehensions means more people are trying — and succeeding — in getting through.

The spikes were apparent across a number of demographic sectors. Cubans, Haitians, illegal immigrant children traveling alone and families traveling together all posted increases.

Likewise every sector along the U.S.-Mexico border saw increases in the number of illegal immigrants nabbed by agents.

Officials took heart in the numbers still trailing the 2016 totals.

“These numbers represent a 41 percent decrease as compared to August of 2016, and year-to-date totals for FY 2017 are 24 percent lower than the same period in FY 2016,” CBP said in a memo detailing the new numbers.

The surge could add urgency to Mr. Trump’s call for border security to be attached to any new bill to legalize illegal immigrant Dreamers.