District of Columbia Mayor Muriel Bowser. (Carolyn Kaster/Associated Press)

D.C. Mayor Muriel E. Bowser (D) this week rejected emergency legislation that would have allowed high school seniors who missed more than six weeks of class to graduate — her first-ever veto.

The measure, passed by the D.C. Council on a 12-to-1 vote last month, came as the school system started enforcing long-ignored attendance policies following a graduation scandal. Lawmakers said it was unfair to punish students by changing the rules during the school year.

The legislation applied only to seniors who satisfied all other academic requirements to graduate.

The measure also would have allowed students in lower grades with significant numbers of absences to advance to the next grade. At the time the measure passed, it was believed 26 seniors would be affected by the legislation.

City policy dictates that students with 30 or more absences in a class should fail, and the legislation would have delayed stringent enforcement of the attendance policy until the 2018-2019 academic year.

Leaders of the District’s public schools had sharply criticized the emergency reprieve.

In a Wednesday letter explaining her veto, Bowser said the bill “sends an inconsistent message” to students and undermined the city’s efforts to promote attendance.

“D.C. Public Schools has invested substantial time and resources to ensure that all students who are off track have pathways to graduation or promotion through summer school, credit recovery or competency-based courses” at alternative schools, the mayor wrote.

Bowser in June easily won the Democratic nomination for mayor and has not drawn a credible general election challenger.

“Ultimately, we believe that mastering the content through one of those alternatives will set students up for long-term success in college or career, and this legislation undercuts individualized graduation plans created for each student,” the mayor wrote.

Robert C. White Jr. (D-At Large), one of the council members who introduced the graduation legislation, said it was unfair to punish students who were given conflicting messages about attendance.

“In changing its attendance enforcement mid-year, DCPS had no regard for the impact on students who followed the rules their schools had given them,” White said in a statement. “DCPS made a mistake, but the only people punished for the mistake were the students. That is simply unfair.”

Had the mayor signed the bill, seniors could have walked at the “rainbow graduation” in early August for students who finished requirements over the summer, and students who were held back because of absences would have advanced before the start of the next school year, according to White’s chief of staff.

White said it would be difficult to override the veto because the Council has adjourned for the summer.

It’s not clear if the nine votes needed to cancel the veto exist: Even some of the council members who voted in favor of the graduation measure expressed concerns about tolerating chronic absences.

The mayor’s veto emerges as her administration has sought to contain a graduation scandal that shattered the image of D.C. Public Schools as a model for urban education reform.

A citywide investigation ordered by Bowser revealed that 1-in-3 graduates in the Class of 2017 received diplomas despite missing too many classes or improperly taking makeup classes.

The FBI and U.S. Department of Education launched probes into the school system. Local school leaders blamed poor training and other factors for shoddy attendance enforcement and vowed to crack down.

Last month, nearly 6-in-10 seniors in the city’s traditional school system earned diplomas — a number education officials expect to rise after students complete summer work. It marked a decline from last year’s record high 73 percent graduation rate.