Matthew G. Whitaker, now acting U.S. attorney general, appears at a roundtable discussion in August at the Justice Department. (Allison Shelley/Reuters)

Maryland’s top lawyer asked a federal judge Tuesday to block Matthew G. Whitaker from serving as acting U.S. attorney general, contending that the appointment is illegal.

Maryland Attorney General Brian E. Frosh (D) said that President Trump’s appointment of Whitaker to the nation’s highest law enforcement post is unconstitutional and that he should be replaced by Deputy Attorney General Rod J. Rosenstein, who was confirmed by the Senate.

“Few positions are more critical than that of U.S. Attorney General, an office that wields enormous enforcement power and authority over the lives of all Americans,” Frosh said in a statement.

Trump tapped Whitaker to serve as acting attorney general last week after Jeff Sessions resigned at the president’s request. Whitaker’s elevation has raised concerns about his qualifications, his past statements as a U.S. Senate candidate and his business practices.

The legal challenge to Whitaker’s appointment comes as part of Maryland’s ongoing federal lawsuit that is trying to force the Trump administration to uphold a key provision of the Affordable Care Act.

“Who the attorney general is is at the core of this lawsuit,” Frosh said in an interview Tuesday.

“Aside from the constitutional issue, this guy, Mr. Whitaker, has extreme views and that’s dangerous in itself,” said Frosh, adding that he also expects any ruling in the state challenge to Whitaker’s role to be appealed.

Frosh was not required to notify Gov. Larry Hogan (R) about a motion in an existing case. Hogan spokeswoman Amelia Chasse said the governor’s office received no prior communication about the filing and declined to comment on it.

The legal action over Whitaker, first reported by NPR, says his appointment violates the Appointments Clause of the Constitution, which requires “principal” senior officials, such as the attorney general, to be confirmed by the Senate. Maryland also contends that the appointment violates a federal statute that lays out the line of succession and gives authority to the deputy attorney general when the top job is vacant.

A Justice Department spokeswoman declined to comment on the Maryland filing. Since Whitaker’s appointment on Nov. 7, Justice Department officials have defended it as legal under the Vacancies Reform Act, an argument repeated Tuesday by White House spokeswoman Mercedes Schlapp on Fox News.

A number of current and former government lawyers have said that while elevating Whitaker to attorney general was unwise and unprecedented, it is not illegal.

Sen. Dianne Feinstein (Calif.), the ranking Democrat of the Senate Judiciary Committee, also raised concerns Tuesday about Whitaker’s appointment and called for hearings to better address the “serious questions” surrounding Trump’s shake-up at the Justice Department and how it could affect the ongoing special counsel investigation of Russian interference in the 2016 election.

Whitaker, who served as Sessions’s chief of staff, is now supervising the investigation by special counsel Robert S. Mueller III. He has previously been critical of the Russia probe — when he was a political commentator and on Twitter.

In a letter to the committee’s chairman, Sen. Charles E. Grassley (R-Iowa), Feinstein said she wants Whitaker to assure lawmakers “he will take no action to restrict or otherwise interfere with” the probe.

Grassley said Tuesday that he takes no issue with comments from Whitaker that disparaged the Mueller investigation, “as long as he made them as a private citizen.”

“It seems to me that the president’s the chief executive, and the president said he wasn’t going to do that,” Grassley said of the ongoing special counsel probe. “So, doesn’t matter what Whitaker thinks. The president said it isn’t going to be done.”

Frosh’s office said Tuesday that any action Whitaker takes in the health-care case on behalf of the federal government would be invalid because Whitaker should not be serving as acting attorney general.

The filing, prepared jointly with the law firm Goldstein & Russell, asks U.S. District Judge Ellen L. Hollander, who has the health-care case, to quickly issue an injunction to replace Whitaker with Rosenstein.

Maryland lawyers filed the underlying lawsuit in September after Sessions told Congress that the Justice Department would not defend central provisions of the health-care act, including protections for people with preexisting conditions.

Now that Whitaker is serving as acting attorney general, he is in position to make decisions on behalf of the federal government, including in the health-care litigation.

“It is troubling, to say the least, that the President is attempting to fill a ‘vacancy’ he created himself with a ‘temporary’ appointment that might last for many months or years,” the filing from Frosh’s office said. “It is especially troubling that the temporary appointee has not been confirmed by the Senate for his underlying position; the President might reasonably be seen as appointing a loyalist in a way that deliberately circumvents the Senate’s constitutional advice-and-consent role.”

Ovetta Wiggins, John Wagner, Devlin Barrett, Erin Cox and Seung Min Kim contributed to this report.