McALLEN, Texas — Illegal crossings along the U.S.-Mexico border, after declining in early 2017, began an unexpected upturn last spring that only recently receded, according to new government figures.

The figures reflect the up-and-down nature of illegal immigration and are reminders that multiple factors — from politics to weather to conditions in home countries — influence who tries to come to the United States and when.

Apprehensions on the southern border in October 2016, a month before Donald Trump’s election, topped 66,000. After Trump’s victory, the number of migrants trying to enter the U.S. illegally reached a 17-year low.

Monthly apprehensions continued to drop into 2017, hitting 15,766 in April, when the downward trend reversed. Apprehensions rose each month to 40,513 in December. Migrant advocates said the “Trump effect” discouraging illegal immigration might be wearing off.

But last month, apprehensions decreased again. It’s not clear whether the post-holiday decrease is seasonal, or whether it will continue.

There were 35,822 migrants apprehended on the southern border in January, according to figures released Wednesday by U.S. Customs and Border Protection. That’s not as many as in December, but it’s more than were apprehended each month last February to October.

The number of families and unaccompanied children caught crossing the border, which rose nearly every month since last spring, also dropped slightly last month to 25,980, but remained more than twice April’s total, 11,127.

In releasing the numbers Wednesday, Homeland Security spokesman Tyler Houlton noted the apprehension figures for children and families were still high.

“Front-line personnel are required to release tens of thousands of unaccompanied alien children and illegal family units into the United States each year due to current loopholes in our immigration laws. This month we saw an unacceptable number of UACs [unaccompanied children] and family units flood our border because of these catch and release loopholes,” he said. “To secure our borders and make America safer, Congress must act to close these legal loopholes that have created incentives for illegal immigrants.”

In Texas’ Rio Grande Valley, so many migrant families with small children arrive daily — more than 15,500 family members so far this fiscal year — that volunteers at a local shelter set up a play area in the corner.

When the number of unaccompanied migrant children caught crossing began to increase in April, fewer than 1,000 were apprehended a month. By last month, that had grown to 3,227. The number of family members caught crossing grew even faster during that time, from 1,118 in April to 5,656 last month.

When Elvis Antonio Muniya Mendez arrived at the shelter last month from Honduras with his 15-year-old son, the playpen was packed with the children of 100 fellow Central American migrants caught crossing the border illegally and released that day. Muniya, 36, had fled a gang that killed his 26-year-old brother the month before. He was hoping to join another brother in Indiana. He and his son were released with a notice to appear in immigration court, which he planned to attend.

“I want to live here legally, without fear,” he said.

Trump administration officials have proposed detaining more families, but that’s not happening in the Rio Grande Valley, where many are released like Muniya with notices to appear in court. The shelter where Muniya stopped, Sacred Heart, saw the number of migrants arriving drop at the end of last year only to increase recently, said the director, Sister Norma Pimentel.

“I’ve never seen so many children be part of this migration,” Pimentel said.

Children who cross the border unaccompanied by an adult are sheltered by the federal Office of Refugee Resettlement and placed with relatives or other sponsors in the U.S. The agency has about 9,900 shelter beds at various facilities. As of this week, the agency was sheltering 7,800 youths.

Children who cross the border with a parent may be released with notices to appear in court or held at special family detention centers.

Trump administration officials have proposed detaining more of the families. But space is limited. As of Monday, the detention centers held 1,896 people. Only one of them can hold fathers, and attorneys said it’s always full, so men who cross with children are often released with a notice to appear in court.

Advocates for greater restrictions on immigration say more needs to be done to hold parents who cross with their children accountable. They say such parents put their children at risk by making the dangerous journey. Andrew Arthur, a former immigration judge now serving as a resident fellow in law and policy at the conservative Washington-based Center for Immigration Studies, said the way migrants are treated on the border encourages family migration.

“The reason the children are there to begin with is this belief that a parent with a child will not be detained,” Arthur said. That assumption, he said, is wrong.

He said Congress and the Trump administration’s unwillingness to end the Deferred Action for Childhood Arrivals program has also encouraged migrant families to make the trip now in hopes of benefiting from a “DACA amnesty,” even though the program is limited to those who grew up in the U.S.

But migrants and advocates said they were driven to cross the border more by conditions in Central America — gang violence and economic downturns — than by U.S. policies.

“Many of these countries, you just cannot live in them,” said Ruben Garcia of El Paso’s Annunciation House shelter. “People will tell you ‘It’s just dangerous to walk around in our neighborhood.’ ”

molly.hennessy-fiske@latimes.com