Defense Secretary Jim Mattis last month objected to using military force to protect border agents on the southwest border, a knowledgeable current U.S. official and a former Defense Department official told The Daily Beast.

But Mattis didn’t object on principle. When the Department of Homeland Security requested the so-called force protection mission from the Pentagon, Mattis declined because he thought he lacked the authority to do so, the current official said.

Mattis’ objection, as of late October, was the genesis of a highly controversial White House memorandum issued late Tuesday explicitly authorizing the potential use of lethal force against the unarmed civilians of the migrant caravan.

DHS wouldn’t take no for an answer, The Daily Beast has learned. Homeland Security went above Mattis’ head in order to get Donald Trump’s chief of staff to secure for them the potentially lethal military force for which immigration hardliners in the administration had clamored.

As first reported by Military Times on Wednesday, the White House has expanded the authorities permitted to the military for a border deployment widely panned as a pre-midterm election stunt. Among those authorities is “a show or use of force (including lethal force, where necessary),” Military Times quoted the memo, should Customs and Border Patrol personnel come under serious threat from an unarmed group of men, women and children.

Unusually, Military Times reported, the memo bore the signature not of President Trump, but his chief of staff, John Kelly, a retired Marine general and former secretary of Homeland Security. Kelly is not in the military chain of command. The White House has yet to release Kelly’s one-and-a-half page memo, but Newsweek published it late Wednesday.

Similar new authorities include “crowd control, temporary detention, and cursory search.” At the Pentagon on Wednesday, Mattis told reporters that he was not envisioning military detention lasting longer than the “minutes” it would take to subdue a hostile individual, restrain them, and then turn them over to civilian authorities to be taken into custody.

There are no credible reports that members of the migrant caravan seek to harm any American, civilian or military. The migrants themselves have come under sporadic attack in Mexico—prompting police protection, rather than violent reprisal, as The Daily Beast reported on Tuesday.

Last month, Mattis approved a plan to deploy what has now become 5,900 active-duty soldiers to the southern border, alongside 2,100 National Guard forces, in support of CBP. A key official pushing for the military deployment was national security adviser John Bolton, initially sidelining Mattis, DHS Secretary Kirstjen Nielsen, and Kelly.

The Daily Beast reported at the time that Mattis did not sign off on everything DHS at the time wanted, including military aid for CBP detentions. The knowledgeable U.S. official tells The Daily Beast that the major thing Mattis objected to was the request for troops to provide what the military calls “force protection” for CBP personnel. (In other words, coming to CBP’s defense if they’re attacked.)

CBP, in 2014, revised its rules on when its border agents can use force, and set a high threshold. They instruct agents to “avoid placing themselves in positions where they have no alternative to using deadly force.” And they require “a reasonable belief that the subject of such force poses an imminent danger of serious physical injury or death to the officer/agent or to another person.” (Physical injury is defined in the 2014 rules as “injury which creates a substantial risk of death or which causes serious disfigurement, serious impairment of health or serious loss or impairment of the function of any bodily organ or structure or involves serious concussive impact to the head.”)

While Kelly’s memo authorizes a “show or use of force,” CBP’s guidelines prohibit “discharging a firearm as a warning or signal” except in “limited circumstances during air or marine enforcement operations” that would not apply to the caravan.

In internal discussions with DHS, Mattis pointed to an April 4 memorandum from Trump on hardening the southern border. That memo directed cooperation between Mattis, Nielsen, and then-Attorney General Jeff Sessions on combating “illegal drugs, dangerous gang activity, and extensive illegal immigration.” (Border crossings have declined over the past decade, and are at levels historically far from “extensive.”) But the memo did not provide Mattis with explicit authorities to use military force, let alone lethal force, in aiding CBP should agents come in danger.

DHS was unwilling to leave the matter at that. The former Defense official said that Homeland Security circumvented Mattis and the Pentagon and instead went directly to the White House in an effort to secure explicit authority for this move from Trump and the West Wing.

And it appears to have worked. Kelly’s memo directly included authorization for lethal military backup.

"The brave men and women at Customs Border and Protection willingly put themselves in extremely dangerous situations every day to protect Americans and their families. The President’s authorization ensures the Department of Defense can step in to protect those who protect us,” said White House Deputy Press Secretary Hogan Gidley on Wednesday.

The first phase of what the military called “Operation Faithful Patriot”—a jingoistic moniker promptly abandoned after the election—emphasized logistics. Thousands of military forces provided fixed- and rotary-wing airlift, temporary housing, and massive amounts of concertina wire. Troops have the right to self-defense, but that was it. Mattis, visiting troops deployed to Texas last week, admitted the long-term goal of the mission was “somewhat to be determined.”

The next phase appears no clearer. After a three-star Army general told Politico that the military would begin to end the mobilization on the southern border by next month, the Army issued a statement on Tuesday walking it back: “We may shift some forces to other areas of the border to engineering support missions in California and other areas. No specific timeline for redeployment has been determined.” The Pentagon later estimated that the border deployment would cost $72 million through December 15.