Attorney General William P. Barr has told associates in recent weeks that he may leave his post before the Trump administration ends next month, according to people familiar with the discussions.

Barr, in his second stint as the nation’s top law enforcement official, since the fall has been the target of growing criticism from President Trump and his supporters — public attacks that intensified in recent days after the attorney general said the Justice Department had not found evidence of widespread voter fraud that could affect the outcome of the presidential contest. But people close to the attorney general, speaking on the condition of anonymity to describe private conversations, said Barr’s contemplation of resigning before Jan. 20 predates that fresh burst of criticism from the right.

Barr first broached the topic with associates shortly after Election Day, when it became clear that former vice president Joe Biden had won, according to one person familiar with the conversation. Before the election, Barr had told friends that if Trump won, he would like to stay on as attorney general for some time in the second term.

One adviser to the president told The Washington Post last week that Barr could be fired. The New York Times reported Sunday that the attorney general was considering stepping down before mid-January.

When Barr first served as attorney general under President George H.W. Bush, he stayed in the position until the administration’s final week. However, it is not uncommon for Cabinet secretaries to leave their positions before the end of a lame-duck term, or contemplate doing so.

On Monday morning, after this story was published, a Justice Department official said, “The AG’s intention is and has been to stay as long as the president needs him.”

Regardless of when and how Barr leaves the job in the next month and a half, Barr’s less than two-year tenure was marked by controversy and criticism.

When he assumed the job in February 2019, he was initially hailed by many former Justice Department officials as someone who understood the institution and would safeguard it. His handling of the special counsel investigation of Trump advisers and Russian interference in the 2016 election soured many department veterans, as did a September speech in which he castigated career employees of his own agency. Given the many controversial decisions he has made, it’s unclear that a resignation, as opposed to a firing or uneventful departure, would much alter public perception of his tenure. Barr has repeatedly brushed aside any questions about his legacy, insisting that he is not concerned about such things.

In recent days, some conservatives have increased their criticism of the attorney general, accusing him of undermining the president’s efforts to throw out ballots in key states, or have Republican-controlled state legislatures choose electors instead.

Trump complained about Barr to reporters on Thursday in the Oval Office, saying, “He hasn’t done anything.” Referring to election fraud, the president said that the Justice Department and the FBI “haven’t looked very hard, which is a disappointment, to be honest with you.”