WASHINGTON — In the days since President Trump ousted Attorney General Jeff Sessions and declared that he was installing Matthew G. Whitaker as the acting attorney general, many critics have challenged Mr. Whitaker’s fitness for the job. Some have gone further, calling his very appointment illegal.

Now, Mr. Whitaker’s appointment is facing a court challenge. The State of Maryland asked a federal judge on Tuesday for an injunction declaring that Mr. Whitaker is not the legitimate acting attorney general as a matter of law, and that the position — and all its powers — instead rightfully belongs to the deputy attorney general, Rod J. Rosenstein.

Mr. Trump may not “bypass the constitutional and statutory requirements for appointing someone to that office,” the state said in a court filing.

[Read Maryland’s court filings.]

The legal action escalates the uproar surrounding Mr. Trump’s installation of Mr. Whitaker as the nation’s top law-enforcement officer, from criticism of his basic credentials and his views on the Russia investigation to challenges to the legality of his appointment. Last week, Chuck Schumer of New York, the Senate’s top Democrat, sent a letter demanding to know why Mr. Trump chose an “unconfirmed political appointee” as acting attorney general, rather than follow the Justice Department’s statutory line of succession.