The University of Virginia violated federal rules on sexual violence issues several times in recent years, failing to provide “prompt and equitable” responses to allegations of sexual assault, the U.S. Education Department said Monday.

Virginia’s flagship public university fell short in its handling of 22 of 50 reports of sexual harassment from 2008 to 2012, the department said. Twenty-one of those reports alleged “sexual assault, some including rape and gang rape.”

“In all of these cases, the university failed to investigate or otherwise determine what occurred,” a federal civil rights investigator wrote. The department also faulted U-Va. in some instances for not promptly investigating information in cases that involved campus fraternities, and it suggested that the university had not done enough to eliminate “a hostile environment” for some students affected by sexual violence cases.

Those were among the conclusions in a 26-page letter from the department’s Office for Civil Rights (OCR) that wrapped up a four-year investigation of U-Va.’s record on sexual violence. The department also released an agreement in which U-Va. pledged numerous steps to prevent sexual violence and improve case handling. Many of the measures — involving ramped-up policies, staffing and training — already are in motion at U-Va.

The end of the OCR probe coincided with the release of a survey on sexual assault at U-Va. and 26 other prominent universities. The survey, gauging student experiences, found that 24 percent of undergraduate women at U-Va. said they experienced sexual assault and misconduct, through force or in situations when they were incapacitated and unable to consent. That was nearly the same as the overall finding for victimization at the 27 schools.

For U-Va., the timing of the OCR report is particularly sensitive. Rolling Stone magazine last fall published an account of a gang rape of a student at a U-Va. fraternity that alleged a culture of indifference to the plight of victims on the Charlottesville campus. The article was later retracted after the gang rape account unraveled, and the magazine’s editors apologized. U-Va. officials, furious at the negative portrayal of their school, asserted strongly that they do not tolerate sexual misconduct and that they fully support students who report violence.

“Harassment and violence in any form have no place in our community,” U-Va. President Teresa A. Sullivan said Monday. “Individual cases, which are often extraordinarily complex, can be debilitating and heart‐wrenching for everyone involved. In responding to these incidents, we will continue to provide compassionate support and care to survivors while better ensuring that our adjudication process is adequate, timely, and fair.

“By signing a resolution agreement … we have agreed to take important steps to continue to improve our efforts in this area. We have already implemented many of the measures identified in the resolution agreement, and we will continue to work to strengthen our efforts.”

The department’s assistant secretary for civil rights, Catherine E. Lhamon, praised U-Va.’s response to the allegations: “President Sullivan’s leadership in crafting an exemplary new policy to address sexual violence and sexual harassment and in confirming her continuing commitment to comprehensive work to assure a safe learning environment at U-Va. sets just the right tone for her students, for which I am deeply grateful.”

The outcome of the probe resembled others that have emerged during the past year and a half at universities such as Michigan State, Princeton and Ohio State: Selected findings of failure to comply with the anti-discrimination law known as Title IX, a recital of steps taken to improve or get back into compliance and pledges to do better in the future.

As of last week, OCR said it was reviewing 163 cases at 139 colleges and universities.

The U-Va. investigation began in June 2011, less than a year after Sullivan took office. The only OCR case dating that far back is at the University of Massachusetts at Amherst.

In the 26-page letter, OCR focused on an associate dean of students, Nicole Eramo, who is widely regarded on campus as a compassionate advocate for sexual assault survivors. The letter said that Eramo helped create a “basis of a hostile environment” through comments she made in September 2014 to a university radio station.

In that interview, Eramo discussed how allegations of sexual assault are handled and the university’s policy on punishment. Without naming Eramo, the letter says she indicated that the university typically does not consider expulsion as a punishment for sexual misconduct, even in instances when a perpetrator admits culpability.

“The radio interview communicates the official position of the university that limited sanctions would be imposed for sexual misconduct brought to the university’s attention,” the letter stated.

A lawyer for Eramo — who filed a lawsuit against Rolling Stone for its depiction of her in the magazine article — declined to comment on the OCR findings.

Sullivan declined to dispute the OCR findings, but she noted that in general the university has sought to keep up with a “fast-moving” set of federal guidance statements on Title IX.

Asked about the findings on fraternities, Sullivan noted that U-Va. does not own fraternity houses, which she said complicates investigations. Asked about the OCR’s finding of fault in U-Va.’s handling of 22 allegations from 2008 to 2012, Sullivan noted that they were all cases in which students chose not to file a formal complaint or proceed through the informal resolution process.

Some sexual assault prevention advocates have suggested that U-Va. is too lenient toward sexual assailants. Last year, U-Va. officials told The Washington Post that the school had expelled no students who had been found responsible for sexual misconduct during the previous decade. That record contrasted with many who had been kicked out for academic dishonesty or other offenses.

But U-Va.’s disciplinary record on the matter has since changed. Asked whether U-Va. has expelled anyone recently for sexual misconduct, Sullivan told The Post that the answer is now yes. But she declined to elaborate, citing federal student privacy laws.

The resolution agreement, which Sullivan signed last week, notes that U-Va. has taken several steps to improve its response to sexual assault. During the last school year, the university revised its investigation protocols to bring them in line with new federal guidance; it expanded its staff dedicated to investigation and prevention; it launched new training programs for students and employees and campaigns called “Not on Our Grounds” and “Hoos Got your Back.” (The latter is a play on “Wahoos,” an unofficial nickname for students at U-Va.) And it hosted a national conference on sexual misconduct prevention in February 2014.