Matthew Whitaker, acting U.S. attorney general, speaks during a meeting with local law enforcement officers in the U.S. Attorney's Office for the Southern District of Iowa in Des Moines, Iowa, U.S., on Wednesday, Nov. 14, 2018.

The Justice Department told President Donald Trump that Matthew Whitaker could hold the post of acting attorney general, before Trump appointed him to that post.

News of that preapproval comes as critics have said Trump violated the Constitution by installing the 49-year-old Whitaker on a temporary basis as the nation's top law enforcement official without first getting Senate approval.

That argument was based on the fact that Whitaker had not held a Senate-approved position before he was appointed acting AG. The state of Maryland cited that claim when it filed a lawsuit Tuesday challenging Whitaker's appointment, calling him an "unqualified" partisan.

But NBC News reported Wednesday that the department told Trump, before he tapped Whitaker for the job, that he could appoint Whitaker as acting head of Justice.

Whitaker was named to the post a week ago, after Trump forced out Attorney General Jeff Sessions.

His temporary appointment immediately sparked concerns that he will squelch the ongoing investigation by special counsel Robert Mueller's office into Russian interference in the 2016 presidential election, and possible coordinating with the Trump campaign in that effort.

Whitaker before joining the Justice Department had been a critic of Mueller's probe. He now has oversight of Mueller's office, due to his appointment as acting attorney general.

Whitaker, a former U.S. attorney for the Southern District of Iowa, had been Sessions' chief of staff. He will be allowed to serve as acting attorney general for at up to at least 210 days.

Steven Engel, assistant attorney general for the Office of Legal Counsel, said in a written opinion cited by NBC News that his office told the White House — before Whitaker was appointed — that the president "could designate a senior Department of Justice official, such as Whitaker, as acting attorney general."

According to Engel's opinion, the Justice Department has identified more than 160 occasions in which a president appointed government officials who not been confirmed by the Senate to serve in high-level positions, NBC News reported.

A senior Justice Department official told NBC that that advice was offered "after the White House asked what the president's option would be in the event the office of attorney general was vacant and who might be eligible to serve."

Trump had been angry at Sessions for more than a year because of the attorney general's decision to recuse himself from overseeing the Justice Department investigation into Russian election interference. Sessions' recusal was based on the fact that he had been involved in Trump's campaign.

The Washington Post reported, a day before Sessions announced his recusal on March 2, 2017, that he had twice met with Russia's ambassador to the United States during the campaign, but failed to disclose that fact during his confirmation hearing in the Senate.

The recusal of Sessions left Deputy Attorney General Rod Rosenstein in charge of the Russia probe. Two months after that recusal, Rosenstein appointed former FBI Director Mueller to handle that investigation.

Mueller's appointment infuriated Trump, who has called the probe a witch hunt.