The University of Virginia has selected a Harvard dean as its next president. (Jabin Botsford/The Washington Post)

James E. Ryan, a scholar of law and education who is dean of the Harvard Graduate School of Education, will be the University of Virginia’s ninth president, school officials announced Friday.

Ryan’s selection comes at a fraught moment for the state’s flagship university, just a month after white supremacists marched on campus during a weekend that brought deadly violence. And it arrives at a time when the university founded by Thomas Jefferson is delving into its complicated history even as it prepares to celebrate its bicentennial.

For the 50-year-old Ryan, whose term will officially begin in October 2018, his elevation to president marks a homecoming: He attended the U-Va. law school and was on its faculty before going to Harvard.

“This in many ways is like returning home,” he said, describing the place where he met his wife and where his four children spent much of their childhoods. “To me, leading is an opportunity to serve, an opportunity to serve an institution and a community that I not only love but that has given a great deal to me and my family.”

His other motivation is his belief in the power of education, he said; his deanship at Harvard has been an opportunity to work with people focused on expanding educational opportunity. “I see being president of U-Va. as a continuation of that,” he said.

Harvard president Drew Gilpin Faust praised Ryan’s work there.

“Jim Ryan elevated the Harvard Graduate School of Education with an effective combination of academic passion and organizational expertise,” Faust said in a written statement. “He excels at developing institutional vision, aligning strategies with their resources and, most importantly, inspiring others to join together to make it happen.”

Stanford Law School Dean Liz Magill speculated that if you had a phone book of all of Ryan’s former colleagues and classmates, “you could call any of them randomly and they would sing his praises.”

Magill, who joined the U-Va. law school faculty with Ryan in 1997, said Ryan loves U-Va’s mission as a public university. That mission is personal: As the first member of his family to go to college, Ryan has a deep connection to the profound ways that higher education can transform lives, Magill said.

She said Ryan also believes universities are powerful forces for good in the world through their ability to solve problems with research and ideas. “He has thought a lot about opportunity and race and class in his thinking about education,” she said, so “some of the challenges that were made very evident by the August events in Charlottesville and U-Va. are ones he’s deeply committed to making progress on.”

Last month, Charlottesville became a national symbol of the threat posed by violent hatred. It also came to represent the struggle over how to mark history when white nationalists converged on the college town to rally around statues of Confederate leaders and the university’s founder, Thomas Jefferson. A woman was killed and others were injured when a man drove into a crowd of people protesting racism. Two police officers died when their helicopter crashed.

The school year began with people asking U-Va. president Teresa Sullivan how white supremacists carrying torches had been allowed to march through campus and clash with students and other counterprotesters.

Next month, the university begins its bicentennial year, with an exploration of Jefferson’s legacy that will include not only his fundamental contributions to the nation’s ideals and the character of U-Va., but also his ownership of slaves and an exploration of race relations at the school.

“The university warmly welcomes Jim Ryan back to Grounds,” Sullivan said in a statement Friday. “The University of Virginia will be in good hands. I am grateful for the opportunity to have served the University, which holds such an important place in higher education, particularly among those with public missions.”

Sullivan announced last winter she would step down from the presidency she has held since 2010. During her tenure, she implemented a strategic plan, began an investigation of the role of slavery at the institution and completed a $3 billion fundraising campaign. She also held the university together through a series of traumatic events.

It’s a difficult time in American higher education, with political and ideological attacks on the academy, as well as cuts in public funding, said Siva Vaidhyanathan, a professor of media studies at U-Va. But it’s an especially difficult time at U-Va.

“This transition is coming at a desperately needed time,” he said. “We’re about to start our third century.” The handoff of the presidency is happening “at the very moment we are looking back at our history and making an honest account of our sins and our successes and looking forward to ask, ‘How can we not only maintain our well-earned reputation but grow into being the best possible university we can be?’ ”

On Friday, he mentioned three subjects he knows will be challenges for U-Va., as they are for most universities: issues of access and affordability, student and faculty diversity, and the evolving use of technology.

Anne Coughlin, a professor at U-Va.’s law school, said Friday she was “absolutely joyful” upon learning of Ryan’s appointment. “I can think of no better choice. He’s a superb scholar, a man of great vision and integrity,” with administrative experience, “thoughtful and balanced and decent and fair,” Coughlin said. “It’s a splendid choice given the challenging racial justice issues that face us today. His focus has been on how to achieve an egalitarian educational system in a world that has been affected by structural racism. . . .

“In terms of where we are now in this historical moment, kudos to U-Va. It is signaling a commitment to studying and rectifying the harms that racism has inflicted and continues to inflict on the educational system,” Coughlin said.

After so many traumatic events in recent years, she said, “much, much more is needed to figure out the path forward …  Because he knows the school well and many people at the school know him well, I think he’ll be able to step in with a great deal of energy and authority because people will trust him.”

At Harvard, Ryan’s sense of mission was powerful and conveyed so clearly to faculty, students and others that he created a strong sense of shared purpose, said Nonie Lesaux, academic dean and a professor at the Harvard Graduate School of Education. “He has, in a good way, shrunk the campus,” she said. “People feel, under his leadership, a strong sense of belonging and community. I don’t say that lightly.”

Lesaux said Ryan encourages everyone to take on the dual challenge of the school: seeking new knowledge about the most pressing problems, then using that knowledge to broker meaningful change. “He genuinely believes, and I think leads by example, that education is really one of the most important levers in society by which to make a difference in the lives of individuals, but also in society as a whole.”

Ryan graduated summa cum laude from Yale University and was first in his law-school class at U-Va. He clerked for Chief Justice William H. Rehnquist and then worked in Newark, N.J., as a public-interest lawyer. He joined the faculty at U-Va. law school, where he rose quickly, becoming academic associate dean, the No. 2 position in the school, and founding and directing the program in law and public service. In 2010, he was honored with an award for his teaching at U-Va. — the same year he argued a case before the U.S. Supreme Court. He won a statewide award in 2011.

Ryan is the author of “Five Miles Away, A World Apart,” using two Richmond area schools to explore how law has shaped educational opportunity in recent history. He has written about school desegregation, school choice, standards, education finance, testing, special education and neuroscience, according to the Harvard Graduate School of Education website.

As a Harvard dean, he gave a commencement speech that was so powerful it went viral, with millions of viewers.

One thing that doesn’t come through in Ryan’s impressive résumé is his joy, Magill said. He throws a good surprise party, she said. He’s ready to laugh, and he plans elaborate (and successful) practical jokes.

His wife, Katie Homer Ryan, is a lawyer for the Education Law Clinic and Trauma and Learning Policy Initiative at Harvard Law School and an adjunct lecturer in education who graduated from the U-Va. School of Law, as did James Ryan, in 1992.

Ryan’s interests, according to a U-Va. statement, include skiing, surfing, mountain-biking, fly-fishing, cooking, photography and running. He and his wife have finished the Boston Marathon for the past seven years.

“It’s a remarkable moment in the history of the institution,” he said of the university’s bicentennial. “It’s a moment to both look back and look forward. … I have been impressed by the willingness of this university to take a hard look at its past and celebrate not just the achievements but talk about the more difficult aspects and the negative aspects of the past.”

But it’s also a natural time to ask, “What does the next century look like? That’s an exciting thought,” he said. “Given what we’ve been through … it’s a great time for a change. The right kind of change.”