WASHINGTON — Homeland Security Secretary Kirstjen Nielsen called a question about whether family separation was a deterrent to border crossings "offensive" on Monday, prompting confusion from observers who pointed out that other White House officials had argued it did just that.

"Because why would I ever create a policy that purposely does that?" Nielsen said, speaking to reporters at the White House. Asked whether the purpose might be "deterrence," she responded, "No."

It could be another case of the Trump administration struggling to stay on message — and on the same page. But what officials say publicly might also affect whether family separation holds up in court.

Nielsen's comments seemed to contradict her predecessor at DHS and current White House Chief of Staff John Kelly, among others. Kelly previously told NPR that family separation "would be a tough deterrent," and said on CNN that it would "deter more movement along this terribly dangerous network." On Monday, Steve Wagner, a top Health and Human Services official in charge of managing children at the border, told reporters that "we expect that the new policy will result in a deterrence effect."

An ongoing class-action lawsuit by the American Civil Liberties Union challenging family separations on behalf of asylum seekers cites previous court cases to argue that the government cannot justify keeping parents away from their children in order to deter possible migrants from coming to the U.S.

While the suit predates the "zero tolerance" policy and does not concern the administration's decision to pursue criminal prosecutions of border crossings, it could affect the administration's ability to detain parents away from their children for extended periods.

"I think referring to pretrial detention as being justified by deterrence risks putting the government’s position on worse grounds," César Cuauhtémoc García Hernández, an associate professor at the University of Denver Sturm College of Law, told NBC News.

Judge Dana Sabraw of the Southern District of California in San Diego allowed the suit to proceed earlier this month, saying the allegations "describe government conduct that arbitrarily tears at the sacred bond between parent and child." He is weighing whether to issue an injunction and allow the ACLU to widen the lawsuit to all families who are put in separate custody.

The ACLU has reason to believe the argument over deterrence is important to the case. In 2015, a judge blocked the Obama administration from a policy detaining families while they pursued asylum cases "for the purpose of deterring future immigration to the United States," prompting the White House to back away from the practice.

During a hearing in May, Sabraw questioned Department of Justice lawyer Sarah Fabian as to whether the government believed "a blanket policy to separate for deterrence value" would pass constitutional muster or violate due process. Fabian said the government was arguing its case on different grounds and that the separation was specific to individual circumstances rather than any broader policy.

"If it was done without any otherwise authority to cause, the separation, I think we might be closer to that problem," Fabian said. "I think what you have to look at, though, is that if the separation is resulting from other discretionary actions that are being taken within the authority and not for the purpose of deterrence, then I think that is how it is not going to be a substantive due process problem."

Nielsen has argued that family separation is not a deliberate decision by the administration, but rather a byproduct of a campaign to prosecute border crossings more aggressively, which requires parents to be placed into federal custody away from their children while they face charges. "This administration did not create a policy of separating families at the border," Nielsen said at her press briefing on Monday.

But one of the attorneys arguing the current lawsuit told NBC News that separate comments by top White House officials suggesting family separation is a deterrent in itself may strengthen their argument.

"I think in court they didn't want to admit it was for deterrence, presumably they thought that was not a legal ground to fight on," Lee Gelernt, an ACLU attorney who argued the case before Sabraw, told NBC News.

If the courts agree, the quotes by Kelly and others could come back to haunt the White House. Judges have already ruled against the administration on separate cases involving issues like the White House’s travel ban and decision to end DACA while citing public comments by President Trump and allies that undermined the government’s legal case.