Defense Secretary Jim Mattis has signed an order extending the mission of active-duty troops on the U.S.-Mexico border through the end of January, the Pentagon announced Tuesday.

The deployment was set to expire Dec. 15, but the Department of Homeland Security requested an extension late last week. The brief statement noted that the extension was approved “in response to migrant caravan arrivals.”

President Donald Trump ordered the deployment just ahead of last month’s midterm elections, amid a flurry of tweets about migrant caravans heading north through Mexico toward the United States.

Some 5,600 active-duty troops are deployed for the mission to Texas, Arizona and California, most of them unarmed and playing a supporting role to civilian agencies under Homeland Security, such as Customs and Border Protection. The number of troops deployed has already dipped slightly from a peak of more than 5,800 last month. Some troops have been assisting CBP agents in closing border crossings between California and Tijuana, where one of the large migrant caravans has encamped.

Asked about the extension last week, Mattis said he would likely grant it, but noted that many of the troops had completed the tasks for which they were deployed, especially those involved in placing concertina wire, concrete barriers and other fortifications at border crossing points. That construction was already “pretty much done,” the Defense secretary told reporters.

Other troops, including helicopter units, have more open-ended tasks such as transporting CBP agents on missions into remote areas between crossing points. Homeland Security also requested a surge of law-enforcement personnel from other civilian agencies to reinforce Customs and Border Protection.

The military is footing the bill for the deployment, since it is separate from the 2,100 National Guard troops sent in the spring. That mission has reportedly cost some $138 million, and Mattis said before granting the extension that he expected the active-duty mission’s cost to rise from $72 million.

The Pentagon’s announcement Tuesday did not specify how many troops would remain beyond Dec. 15 or whether troops who are already there would be replaced by new ones. But the military said in a separate statement on Friday that the extension request “refines support to ensure it remains aligned with the current threat, the nature of the mission, and CBP operational requirements.”