Attorney General William P. Barr — who has recently faced criticism from President Trump for not prosecuting his political rivals — has told friends and advisers in recent weeks that he hopes to stay on for some time in the next term, if Trump wins the election.

The assertion from the president’s top law enforcement official might otherwise be unsurprising, if not for the public pressure Trump has put on Barr in recent months to deliver results from an investigation Barr specially commissioned to review the FBI’s 2016 probe of possible coordination between Russia and Trump’s campaign.

Trump also has openly discussed with advisers firing FBI Director Christopher A. Wray after Election Day, even though Wray is only a little more than three years into what is normally a 10-year appointment. Barr has generally sought to shield Wray from Trump’s wrath, though his friends believe he would not resign in protest were the FBI director ousted, people familiar with the matter said. Like others, they spoke on the condition of anonymity to discuss the politically sensitive topic.

An FBI spokesman declined to comment.

Even amid the president’s attacks, the attorney general has conveyed to friends he would like to stay on the job.

“Barr told me recently he supports the president and would be inclined to stay if the president wanted him to,” said Richard Cullen, a lawyer and longtime friend of Barr who represented Vice President Pence.

It is less clear what Trump wants to do.

In August, Trump told Fox Business’s Maria Bartiromo that Barr “can go down as the greatest attorney general in the history of our country, or he can go down as an average guy,” depending on the results of the investigation, led by U.S. Attorney John Durham in Connecticut, into the FBI’s 2016 probe of Trump’s campaign. Trump has agitated for criminal charges or investigations for those he considers political rivals — including former FBI director James B. Comey, former FBI deputy director Andrew McCabe and even former vice president Joe Biden, his opponent in the 2020 race.

More recently, after news reports that results from Durham’s investigation would not be made public before the election, Trump told conservative radio host Rush Limbaugh: “I think it’s a terrible thing. And I’ll say it to [Barr’s] face.”

Trump has called publicly for his attorney general to appoint a special prosecutor to investigate Biden and his son Hunter, and declined to say whether he would want Barr around in a second term.

A person familiar with the matter said previously that while Barr understands Trump’s frustration about the Durham probe, his pressure was “not going to change anything.” Barr has said previously that Biden was not under investigation in that case. The person said that Barr wants to stay on to see the end of Durham’s work, though it is unclear how long he envisioned his tenure lasting.

In a statement for this story, White House spokesman Judd Deere noted how Barr has carried out the president’s agenda, pointing to an anti-violent crime initiative called “Operation Legend” and other moves. But Deere would not disclose what the president planned to do with his Cabinet after the election.

“The Department of Justice under the leadership of Attorney General Barr has worked to carry out the President’s priorities, including restoring law and order to our communities through Operation Legend, confronting China, and combating human trafficking and smuggling,” Deere said. “We have no personnel announcements at this time nor would it be appropriate to speculate about changes after the election or in a 2nd term.”

The Justice Department declined to comment.

Barr has at times found himself at odds with Trump, and earlier this year, he publicly rebuked the president for tweeting about criminal cases. But his relationship with the president is far better than that of his predecessor, Jeff Sessions. Upset that Sessions had recused himself from the Russia investigation, which would come to be led by special counsel Robert S. Mueller III, Trump repeatedly and publicly mocked his attorney general and ultimately ousted him from the position.

Critics say Barr has worked to undermine the Russia investigation during his time as attorney general and has used the Justice Department to try to help Trump’s friends. But his defenders note he has not brought charges against even those Trump considers rivals, such as McCabe and Comey, who have faced Justice Department investigations.