James Ryan, the president of the University of Virginia since 2018, announced his resignation under intense pressure from the Trump administration.

The Civil Rights Division of the Trump administration pressured the Board of Governors of the university to remove Ryan because of his support for diversity, equity, and inclusion.

They said that he pretended to comply with the federal demands to eliminate DEI but merely renamed them.

For the past half century, DEI was considered a hallmark of compliance with civil rights laws. DEI programs encouraged women and nonehites to enroll in higher education and to study the history of discrimination.

Under Trump, DEI has been reinterpreted to mean favoring those groups at the expense of white men and thus discriminating against white men.

The Trump administration has cut federal grants to universities that are slow or unwilling to dismantle DEI programs.

The New York Times reported that lawyers for the Civil Rights Division demanded Ryan’s ouster.

The demand to remove Mr. Ryan was made over the past month on several occasions by Gregory Brown, the deputy assistant attorney general for civil rights, to university officials and representatives, according to the three people briefed on the matter.

Mr. Brown, a University of Virginia graduate who, as a private lawyer, sued the school, is taking a major role in the investigation. He told a university representative as recently as this past week that Mr. Ryan needed to go in order for the process of resolving the investigation to begin, two of the people said.

Harmeet K. Dhillon, the Justice Department’s top civil rights lawyer, has also been involved in negotiations with the university. She received her law degree from the University of Virginia, where she was a student in the law school at the same time as Mr. Ryan…

Mr. Ryan, hired in 2018 as the university’s ninth president, has leaned into issues like making the school more diverse, increasing the number of first-generation students and encouraging students to do community service. But his approach, which he says will make the university “both great and good,” has rankled conservative alumni and Republican board members who accuse him of wanting to impose his values on students and claim he is “too woke.”

Before becoming the University of Virginia’s president, Mr. Ryan served as the dean of the Harvard Graduate School of Education, where he was praised for his commitment to D.E.I. programs. Harvard has been one of the Trump administration’s chief targets since it began its assault on higher education.

The administration’s attempt to assert federal influence over state university leadership decisions is also illustrative of how Mr. Trump’s political appointees continue to wield the Justice Department’s investigative powers to achieve policy goals long sought by a top Trump adviser, Stephen Miller.

Legal experts said they could think of few other instances in which an administration had demanded that a school have its president removed in order to resolve a Justice Department investigation.

“This is a tactic you would expect the government to use when it’s playing hard ball in a criminal case involving a corporation accused of serious wrongdoing or pervasive criminal activity,” said Daniel C. Richman, who is a law professor at Columbia University and a former federal prosecutor.