Judge Merrick Garland is the right person at the right time to be President Joe Biden's attorney general.

If the AP and Politico are correct that he's Biden's pick, it isn't just well-deserved vindication for a dedicated public servant who deserved to be confirmed to the Supreme Court when nominated by President Barack Obama. Garland's years of experience in the Department of Justice, coupled with his distinguished service on the federal bench, position him to accomplish the historic mission now demanded of him: nothing less than restoring the legitimacy and credibility of federal law enforcement after the disastrous last four years of Donald Trump's presidency.

Garland is an insider's insider when it comes to understanding how the Department of Justice works — and what its proper function should be. Since 1978, when he clerked for Justice William Brennan at the Supreme Court, he has spent his entire career within the gravitational field of the building known as "main Justice," located at 950 Pennsylvania Ave. He was a special assistant to President Jimmy Carter's attorney general Benjamin Civiletti; a federal prosecutor in Washington, D.C.; a deputy assistant attorney general; and principal deputy associate attorney general. In between, he spent short stints at the venerable D.C. law firm Arnold and Porter. President Bill Clinton put him on the U.S. Court of Appeals for the D.C. Circuit in 1995. The court is just a few blocks away from main Justice, and it hears many, many cases involving the federal government.

This insider status will be a huge help to Garland in running the Justice Department. The permanent staff will accept and respect him from day one. He knows how power works within the department's highly complex bureaucracy and he will know how to choose and supervise his political appointees.

Above all, Garland's 25 years on the D.C. Circuit established his reputation as a smart, centrist, nonideological legal thinker — a straight shooter who acted on the basis of principle and the rule of law. That's important because his first task as attorney general will be to restore the department's reputation for nonpartisan integrity in criminal prosecution and investigation, which was painstakingly built in the decades after Watergate and quickly shredded during Trump's four years in office.

Nothing in the Constitution requires an independent-minded or nonpartisan policy of criminal investigation and prosecution. The attorney general is appointed by the president, and Justice is part of the executive branch, without formal independence.

Yet a Justice Department that chooses its targets based on politics, not principle, can badly undermine the rule of law. That's what Trump's department did, both under William Barr and his predecessor, Jeff Sessions. At the president's urging, the department's senior leadership repeatedly sent the message that the president's friends would be singled out for positive treatment and that his enemies would be investigated and potentially prosecuted to the fullest extent allowed by law.

Over the last four years, career lawyers at the Justice Department have tried to resist this politicization, often with some success. But the perception nationally has been that main Justice has lost much of the nonpartisan independence that it previously possessed.

Garland can, and must, make it his highest priority to reverse this perception. The solution isn't to bring high-profile prosecutions that are specifically designed to refute any suspicions of politicization; rather, it's to ignore politics and prosecute whoever deserves to be prosecuted.

Garland needs to say publicly and loudly that career prosecutors will be empowered to rely on their own judgment. He needs to say frequently and convincingly that he will stand up for the department's independence in the face of any pressure that might come his way.

As part of this effort, the department should adopt new departmental regulations that further protect prosecutorial decisionmaking from interference by political appointees. The special prosecutor regulations, in particular, are in need of a major overhaul. Unintended loopholes in those regulations have been exploited by Barr and others. Now that these problems have been identified the hard way, Garland should supervise the process of drafting revised regulations to solve them.

Then there's restoring the badly damaged credibility of the department's Office of Legal Counsel. That office traditionally prided itself on producing scholarly, thoughtful, independent assessments of the constitutionality of proposed laws and executive actions. Under the Trump administration, the OLC instead functioned to a troubling degree as an adjunct of White House policy preferences, issuing opinions that did not convince the vast majority of constitutional lawyers. Garland should choose OLC leaders who are prepared to stand up to the White House — and he should back them when they do.

The attorney general will always answer to the president, formally speaking. But the nation's top law-enforcement official should re-establish the norm that his true client is the United States, not the president, and that the AG's highest commitment is to the Constitution and the rule of law, not the White House.

Noah Feldman is a Bloomberg Opinion columnist and host of the podcast "Deep Background." He is a professor of law at Harvard University and was a clerk to U.S. Supreme Court Justice David Souter. His books include "The Three Lives of James Madison: Genius, Partisan, President.