A new top legal hire at the University of Virginia is proof positive that pointing out flaws with a future employer may sound like a bad move—but it isn't always.

Timothy Heaphy, a former top federal prosecutor who was critical of UVA's handling of last year's violent protests in Charlottesville, has been tapped to be the school's chief lawyer.

Heaphy is a UVA alum and a partner at Hunton Andrews Kurth, where he chairs the firm's white-collar defense and internal investigations practice in Richmond and Washington, D.C. He is set to take over as university counsel on Sept. 1.

Virginia Attorney General Mark Herring appointed Heaphy to the university counsel position, which reportedly pays $179,000 a year. He previously served as U.S attorney for the Western District of Virginia.

“I'm really motivated by public service. This is a public service opportunity. It's a mission-driven choice for me,” Heaphy said in an interview Friday. Noting that this is his first foray into academia, he added that he has a “steep learning curve ahead on some of the issues that come up at colleges and universities,” including the intersection of public safety and free speech.

Heaphy knows that terrible collisions can occur at that intersection: He was picked last year to spearhead a review of the protests that unfolded during a white supremacist rally in Charlottesville and left several people injured and one dead.

The independent investigation that Heaphy headed resulted in a lengthy report that concluded that the local police department, city council, city and state attorneys, state police and UVA botched the planning and response to the protests.

“UVA has some experience, a bit of a trial by fire here,” Heaphy said. “The goal is to ensure that everyone has their right to free expression and we also have to protect student safety. And that's hard.”

According to UVA, Heaphy's report, while critical of the school, had a silver lining as it “led to the development of new policies and procedures regarding how to better manage public protests while also ensuring First Amendment protections and public safety,” the university stated in the announcement of Heaphy's appointment.

He'll move into the university counsel position after Roscoe Roberts retires from the role, which Roberts has held since 2014. Roberts, a former assistant attorney general for the commonwealth, previously served as legal counsel at several other universities, including Virginia State.

As the leader of UVA's Office of University of Counsel, Heaphy will give “strategic advice” to the university's Board of Visitors and UVA president James Ryan, according to a statement from the school. Heaphy's office also provides legal counsel to the school's other executive officers, administrators, faculty and staff in their official capacities.

According to a report in The National Law Journal, Heaphy's tenure as a U.S. attorney began in October 2009 and included numerous criminal and fraud cases, like the killing of a Waynesboro, Virginia, reserve police officer and a fake ID ring bust.