Acting attorney general Matthew G. Whitaker spoke at the Department of Justice's Annual Veterans Appreciation Day Ceremony on Nov. 15 in Washington. (Pablo Martinez Monsivais/AP)

Senior Justice Department lawyers advised acting attorney general Matthew G. Whitaker not to sign a gun regulation change earlier this week, warning him that doing so could lead to a successful legal challenge to his appointment as the nation’s top law enforcement official, according to officials familiar with the discussions.

Whitaker, who was picked by President Trump in early November to lead the Justice Department on a temporary basis, also heard from Justice Department officials who felt he should sign a change in gun regulations that effectively bans the use of bump stocks, devices that attach to semiautomatic rifles and allow them to fire more like automatic weapons, these people said. He signed the document on Tuesday.

The internal debate over Whitaker’s signature, which began weeks ago, shows how concerned even top Justice Department executives are that his appointment to acting attorney general is vulnerable to a legal challenge, particularly when lawyers suing the department over various policy issues need to find only one federal judge who agrees with that position, according to officials familiar with the discussions. They spoke on the condition of anonymity to detail internal discussions.

The concerns come at a fraught moment in Whitaker’s short tenure in the top job, after it was revealed Thursday that senior ethics officials had said Whitaker should recuse himself from overseeing special counsel Robert S. Mueller III’s probe of Russian interference in the 2016 election. Whitaker decided instead to follow the recommendation of other aides, prompting angry criticism from Democrats who say he is flouting the rule of law.

A Justice Department spokeswoman declined to comment.

Whitaker is overseeing the Justice Department while William P. Barr awaits confirmation hearings in the Senate to become the next attorney general. Those hearings have yet to be scheduled, and Whitaker could stay in the job for another month or more.

The litigation concerns surrounding Whitaker are partly fueled by anxiety inside the Justice Department about judicial activism, most often reflected in what some lawyers call the “national injunction” problem — that when lawyers challenge a particular government policy in court, a lone U.S. District Court judge has the authority to issue a court order blocking that policy across the entire country. Judges have issued such injunctions against Obama administration policies and Trump administration policies, but most of the criticism of national injunctions comes from conservative lawyers, who say lower court judges should not have such an outsized impact on federal government decisions.

The advice from senior officials that Whitaker refrain from signing the bump-stock ban was not universal; the department’s office of legal counsel and other agency lawyers believed he could, according to people familiar with the matter. That office wrote a memo last month concluding Whitaker’s appointment as acting attorney general was legal, despite his not being in a Senate-confirmed position in the government before he became attorney general.

The memo concluded that the president does have the authority to appoint someone like Whitaker to the top job in the department on an acting basis. Before his appointment, Whitaker had been serving as chief of staff to then-Attorney General Jeff Sessions.

The memo said the Vacancies Reform Act allowed for that possibility, and pointed to past instances where such appointments had been made, though the vast majority of the examples dated from before the Civil War.

The concern expressed by senior Justice Department officials who did not want Whitaker to sign the bump-stock ban was that by doing so, it presented a litigation risk to him and the department; a judge considering legal challenges to the ban could also be asked to rule on whether Whitaker was legally appointed as attorney general. If a judge ruled against him, Whitaker would be in the unfortunate position of having a federal judge declare he wasn’t really the attorney general, these people reasoned.

The discussions took place off and on over about two weeks, and ultimately Whitaker sided with the lawyers who said he could sign the regulation. Even if a judge ruled against him, officials said, another Justice Department official could immediately re-sign it and avoid a significant delay in the ban on bump stocks.

The day the ban was announced by the Justice Department, a handful of gun-rights groups said they would challenge it in court, and attack Whitaker’s authority to implement such a change. Their lawsuit filed in federal court in Washington, D.C., refers to Whitaker as “the purported acting attorney general.”

The suit contends Whitaker “is unable to lawfully perform the duties and responsibilities of attorney general, including the execution on December 18, 2018 and implementation of the final rule.”

Others, including some Senate Democrats and the attorney general for Maryland, have already mounted legal challenges to Whitaker’s appointment, saying that Deputy Attorney General Rod J. Rosenstein, who is Senate-confirmed, is the rightful acting attorney general.

Justice Department officials have declined to say exactly which powers of the attorney general Whitaker is exercising, and the legal wrangling over his appointment is part of a broader lawsuit seeking to force the Trump administration to uphold a key section of the Affordable Care Act.

The Maryland attorney general wants Whitaker removed from the position where he can make decisions on behalf of the federal government about the health-care litigation.

At a federal court hearing Wednesday in Baltimore, Justice Department lawyers refused to say whether Whitaker is directly involved in discussions about the litigation. Justice Department attorney Hashim M. Mooppan defended the Whitaker appointment as “sensible and reasonable,” and said Congress has given the president the power to decide how to fill temporary vacancies, but would not disclose “internal workings of the department,” including whether Whitaker is personally participating in such discussions.

“I’m not saying it’s privileged; I’m saying it’s not appropriate,” Mooppan said at the hearing.