The Justice Department’s internal watchdog has begun reviewing the controversial handling of the sentencing recommendation for Roger Stone, a longtime friend of President Trump who was convicted of lying to the House Intelligence Committee during its investigation of Russian interference in the 2016 election, a Justice Department spokeswoman said Monday.

It was not immediately clear what sparked the Justice Department inspector general’s inquiry. Stone’s treatment has long drawn criticism from legal observers and lawmakers who said Attorney General William P. Barr seemed to be inappropriately affording favorable treatment to a friend of the president.

Earlier this year — when Stone was still awaiting his sentence — Barr personally intervened to overrule the sentencing recommendation career prosecutors had offered to the court, prompting all four of them to withdraw from the case. Two have since publicly criticized the move as being politically motivated, with one testifying under oath before Congress about it.

Kerri Kupec, a Justice Department spokeswoman, said in a statement, “We welcome the review,” which was first reported by NBC News. A spokesperson for Inspector General Michael Horowitz declined to comment.

Stone was sentenced in February to serve three years and four months in prison for impeding the congressional investigation. Trump commuted that penalty in July, before Stone was to begin serving his term. A White House spokeswoman said in a statement at the time that Stone had been a “victim of the Russia Hoax.”

Barr’s intervention over the sentencing recommendation came after Trump had tweeted about Stone’s case, suggesting his friend deserved leniency.

“This is a horrible and very unfair situation,” Trump tweeted at the time. “The real crimes were on the other side, as nothing happens to them. Cannot allow this miscarriage of justice!”

Prosecutors had recommended Stone deserved a sentence of seven to nine years in prison, which is what federal sentencing guidelines had called for. But Barr thought otherwise, and — after career prosecutors withdrew — the Justice Department proposed a less severe penalty.

Barr has defended the move and said it was not related to Trump’s tweet. Soon after, he said publicly that the president’s social media missives “make it impossible for me to do my job.” Democratic lawmakers, including Senate Minority Leader Charles E. Schumer (D-N.Y.) and those on the House Judiciary Committee, called on the inspector general to look into the matter.

Barr has faced persistent criticism for taking steps that seem to undercut the FBI’s 2016 investigation of whether Trump’s campaign coordinated with the Kremlin. That probe, which was ultimately taken over by former special counsel Robert S. Mueller III, produced charges against several of Trump’s closest aides and advisers, including Stone.

The Justice Department under Barr similarly intervened to try to dismiss the case Mueller brought against former national security adviser Michael Flynn, who pleaded guilty in 2017 to lying to investigators about his interactions with a Russian diplomat. A court is still considering that request.

Jonathan Kravis, one of the career prosecutors who withdrew from the Stone case and quit government entirely after Barr’s intervention, wrote in a May Washington Post column that in both the Flynn and Stone cases, “the department undercut the work of career employees to protect an ally of the president, an abdication of the commitment to equal justice under the law.”

Aaron Zelinsky, another Stone prosecutor and a member of Mueller’s team who currently works as an assistant U.S. attorney in Maryland, testified to the House Judiciary Committee in June that prosecutors experienced “heavy pressure from the highest levels of the Department of Justice” to give Stone “a break.” While Zelinsky conceded he had never talked to Barr, Barr’s top deputy or even the politically appointed U.S. attorney in D.C. about the matter, he said it was his “understanding” that his supervisors had.

“What I heard — repeatedly — was that Roger Stone was being treated differently from any other defendant because of his relationship to the president,” he said in prepared remarks, adding later, “I was also told that the acting U.S. attorney was giving Stone such unprecedentedly favorable treatment because he was ‘afraid of the president.’ ”

Devlin Barrett and Spencer S. Hsu contributed to this report.