President Trump walks back to the Oval Office after speaking in the Rose Garden. (Jabin Botsford/The Washington Post)

Kenneth W. Starr, a former U.S. solicitor general and federal judge, served as independent counsel in the Whitewater and Monica Lewinsky investigations during the Clinton administration.

Mr. President, please cut it out. Tweet to your heart’s content, but stop the wildly inappropriate attacks on the attorney general. An honorable man whom I have known since his days as a U.S. attorney in Alabama, Jeff Sessions has recently become your piñata in one of the most outrageous — and profoundly misguided — courses of presidential conduct I have witnessed in five decades in and around the nation’s capital. What you are doing is harmful to your presidency and inimical to our foundational commitment as a free people to the rule of law.

The attorney general is not — and cannot be — the president’s “hockey goalie,” as new White House Communications Director Anthony Scaramucci described Sessions’s job. In fact, the president isn’t even his client. To the contrary, the attorney general’s client is ultimately “We the People,” and his fidelity has to be not to the president but to the Constitution and other laws of the United States. Indeed, the attorney general’s job, at times, is to tell the president “no” because of the supervening demands of the law. When it comes to dealing with the nation’s top legal officer, you will do well to check your Twitter weapons at the Oval Office door.

(Taylor Turner/The Washington Post)

A rich history buttresses my uninvited but from-the-heart advice. In the wake of President Richard Nixon’s resignation, the colorful Sen. Sam Ervin (D-N.C.) — a hero of the long Watergate ordeal — held hearings on a newly minted proposal to create an independent Justice Department, along the lines of other independent agencies such as the Federal Communications Commission. The idea was simple: Especially in the wake of the Nixon-era scandals infecting it, the department should, to the fullest extent possible, be insulated from raw political considerations in the enforcement of the nation’s laws.

Although nobly intended, Ervin’s reform proposal went nowhere. But along the way, a national civics lesson unfolded. One of the “teachers,” so to speak, was Ted Sorensen, President John F. Kennedy’s legendary speechwriter. In the hearings on the proposal, Sorensen spoke eloquently about the need for the president to have trust in the attorney general but at the same time for the attorney general to remain at arm’s length in providing honest legal guidance to the president.

This represents a paradox. As a member of the president’s Cabinet, the attorney general needs to be a loyal member of the president’s team, yet at the same time he must have the personal integrity and courage to tell the president what the law demands — and what the law will not permit. That’s especially true with respect to enforcing the nation’s criminal laws, and why — rightly — the attorney general needs to step aside on matters where his own independence of judgment has potentially been compromised.

That’s the key to solving the paradox. Independence of judgment, as opposed to blind loyalty, characterizes great attorneys general. An example from the Reagan years illustrates the point: Attorney General William French Smith sat down one-on-one with President Ronald Reagan and advised him that one of the administration’s favorite tools — the legislative veto, which was a congressional contrivance used to strike down agency regulations — violated our system of separation of powers and was thus unconstitutional.

In coming to that wildly unpopular position, Smith (I was his chief of staff at the time) had been persuaded by the department’s chief constitutional lawyer, Ted Olson. Having determined that Olson — and the entire Office of Legal Counsel — was spot on in its analysis, Smith outlined the department’s thinking in his session with Reagan in the White House residence. Reagan listened intently and immediately accepted his attorney general’s advice. No taking the matter “under advisement” or consulting with White House lawyers. As with Kennedy and his younger brother, Bill Smith and the president were close personally and politically. What the attorney general said, the president accepted. It was a matter of trust.

How to manage the paradox — loyalty to the president leavened by rock-ribbed integrity of judgment? It comes down to courage on the part of the attorney general and a willingness by the president to listen respectfully to what he may well not want to hear.

Oliver Wendell Holmes Jr. once opined that in our life as a society ruled by law, a page of history is worth a volume of logic. Experience teaches that even a 21st-century “drain the swamp” president would do well to tweet a little less and listen a little more to the voices of the past — bringing back to mind what President Abraham Lincoln elegantly described as “the mystic chords of memory.”

Mr. President, for the sake of the country, and for your own legacy, please listen to the growing chorus of voices who want you to succeed — by being faithful to the oath of office you took on Jan. 20 and by upholding the traditions of a nation of laws, not of men.