WASHINGTON — During his 20 months in office, Attorney General Jeff Sessions has swept in perhaps the most dramatic political shift in memory at the Justice Department, from the civil rights-centered agenda of the Obama era to one that favors his hard-line conservative views on immigration, civil rights and social issues.

Now, discontent and infighting have taken hold at the Justice Department, in part because Mr. Sessions was so determined to carry out that transformation that he ignored dissent, at times putting the Trump administration on track to lose in court and prompting high-level departures, according to interviews over several months with two dozen current and former career department lawyers who worked under Mr. Sessions. Most asked not to be named for fear of retribution.

President Trump has exacerbated the dynamic, they said, by repeatedly attacking Mr. Sessions and the Justice Department in baldly political and personal terms. And he has castigated rank-and-file employees, which career lawyers said further chilled dissent and debate within the department.

The people interviewed — many yearslong department veterans, and a third of whom worked under both the Bush and Obama administrations — said that their concerns extended beyond any political differences they might have had with Mr. Sessions, who is widely expected to leave his post after November’s midterm elections.