The top education aide to D.C. Mayor Muriel E. Bowser (D) resigned Friday after helping the public schools chancellor bypass the city’s notoriously competitive lottery system and secure a coveted slot for his teenage daughter at a top high school.

The lottery system, used to place students in the District’s traditional public and charter schools, is intended to ensure that all families have an equal shot at the best schools. But it has been a longstanding source of tension, and was engulfed in scandal not even a year ago when investigators discovered that a previous chancellor allowed well-connected parents and government officials to skirt lottery rules.

Friday’s revelation emerged as the D.C. Public Schools struggled to address a separate crisis involving high school graduation, and it threatened to further erode public confidence in a school system heralded as a model of urban education.

Bowser disclosed that the transfer of Chancellor Antwan Wilson’s daughter had broken a policy banning preferential treatment for the children of government officials that the chancellor wrote just months earlier. When his family decided the school attended by his oldest child was not a good fit, Wilson approached a deputy mayor, and the teen was transferred to Wilson High School in Northwest D.C. without having to participate in the school lottery.

“This whole thing, that our city leaders are opting out of our neighborhood schools shows that they don’t believe they are good enough to serve all students, or they don’t have the resources to serve all students,” said Joe Weedon, the Ward 6 representative on the State Board of Education and a D.C. Public Schools parent.

The resignation of Bowser’s top education aide, Deputy Mayor for Education Jennifer Niles, was immediate. Niles’s chief of staff, Ahnna Smith, was named interim deputy mayor.

“I have confidence in his vision and leadership,” the mayor said, “but I also know that he has taken responsibility for the mistakes he has made.”

Bowser said she had instituted “corrective actions” that included the removal of the chancellor’s child from Wilson High. The city’s Board of Ethics and Government Accountability and the inspector general were enlisted to examine if the chancellor violated the city’s code of conduct.

The mayor ordered Wilson to write a public apology to parents.

“My decision was wrong and I take full responsibility for my mistake,” Wilson said. “While I understand that many of you will be angered and disappointed by my actions, I’m here today to apologize and ask for your forgiveness.”

Wilson moved from California to lead the D.C. school system a year ago. His wife and three children finished the academic year on the West Coast before moving to the District last summer. Wilson participated in the lottery process to find schools for his children, and his oldest child enrolled in the Duke Ellington School of the Arts in the fall as a sophomore, according to a mayoral administration official briefed on the matter who could not be named because of the sensitivity of the situation.

A few weeks into the academic year, the family decided the arts magnet school was a poor match, and Wilson approached Niles. The administration official said Wilson, knowing strict rules govern school placement, had his wife speak and coordinate with Niles. Wilson’s daughter was transferred to Wilson High, a high-performing neighborhood school in Northwest D.C. with a wait list.

Wilson and his family live in the Brookland neighborhood in Northeast Washington, and his daughter’s neighborhood school is Dunbar High. His younger two children attend J.O. Wilson Elementary School, which they matched with through the lottery process.

Niles, who was tapped as deputy mayor in 2014, did not comment on the actions she took to help the chancellor’s daughter transfer schools, but said in a statement that it has been a privilege to work for the city’s children. Niles is a prominent leader in the charter school movement, and founded and led E.L. Haynes Public Charter School, which is considered one of the most successful charter schools in the city.

“I am hopeful for the future of public education in our city as we move closer to achieving the mayor’s vision where all children have access to a world-class education that prepares them for college, career and life,” Niles wrote.

The policy Wilson violated was one he wrote, in response to the first prominent scandal he confronted as schools chancellor. That scandal arose out of the lottery system, one of the most notoriously stress-inducing aspects of life in the District’s public schools.

Children who want to attend a school outside their neighborhood must enter the citywide lottery and abide by the results. D.C. parents strategize about how to rank their school choices and even hire consultants to navigate the system.

Last May, The Washington Post obtained and published a confidential report by the D.C. inspector general’s office that concluded former chancellor Kaya Henderson had allowed well-connected parents and government officials — including two senior aides to Bowser — to bypass the school lottery rules. In response to outrage from parents, the mayor halted special transfers outside the normal school enrollment rules and ordered Wilson to draft a policy addressing concerns about the process.

In June, Wilson signed his name to a seven-page policy limiting school officials’ ability to move children between schools outside the lottery regulations and banned such transfers for the children of D.C. government officials.

“No past or current public officials will receive such a placement, to limit any possibility of favoritism or improper use of public office for private gain, or even the appearance of favoritism,” Wilson wrote in a letter about the policy to D.C. Council member and Education Committee Chairman David Grosso (I-At Large).

Three months later, Wilson violated that policy.

Bowser said she was not aware the chancellor’s daughter had transferred to Wilson High. A spokeswoman for Bowser said the mayor’s chief of staff and top advisers were also unaware.

“We spent quite some time crafting those rules, and it appears from everything we have seen this week that the policies were not followed and the deputy mayor was aware of this,” Bowser said.

Council member Elissa Silverman (I-At Large) said Friday she had already received “exasperated” emails from families who felt the chancellor’s apology did not go far enough.

“Wilson faced a dilemma encountered by many . . . parents: A neighborhood school does not meet their child’s needs,” Silverman said. “Wilson’s solution was to break a rule, crafted by him, in response to a prior school lottery scandal. That is infuriating.”

Danica Petroshius, a Capitol Hill resident and parent of two children in D.C. public schools, called the apology inadequate.

“This sends us over the edge,” Petroshius said. “He wrote the new policy, but he didn’t follow it. It’s inexcusable.”

Ward 8 Council member Trayon White (D) has worked closely with the chancellor, and said he doesn’t believe Wilson intentionally gamed the system.

Grosso said he was “extremely disappointed” in Niles and Wilson.

“The chancellor’s going to have to earn people’s trust back, and I think he understands that,” he said. “But does it elevate to the level where we should bring somebody else in and start from scratch after he’s made good progress? I don’t know. That’s the mayor’s decision.”

D.C. Schools Chancellor Antwan Wilson greeted students on his first day on the job a year ago. (Sarah L. Voisin/The Washington Post)