New York City Schools Chancellor Richard A. Carranza will step down on March 15 after nearly three years on the job, Mayor Bill de Blasio said in a surprise announcement Friday. He will be succeeded by Meisha Ross Porter, who will be the first Black woman to run the country’s largest school system.

Carranza’s departure comes at a time when the district of 1.1 million students is working to keep schools open during the coronavirus pandemic — and after repeated clashes with the mayor about who was in charge of education policy and how to desegregate the city’s schools.

In remarks to the Board of Education on Friday, Carranza did not say directly why he was leaving but noted that he is a New Yorker who has lost 11 family members and close friends to covid-19 and he “needs to take time to grieve.”

He called his departure “bittersweet” and said he and his team had accomplished a great deal, including raising graduation and college enrollment rates and implementing restorative justice practices.

“We made true progress in dismantling structures and policies that are products of decades of entrenched racism — like suspending school screens,” he said. “And we finally brought mental health into the spotlight and made it a major priority — which has been tremendously crucial during the pandemic.”

Michael Mulgrew, president of the United Federation of Teachers, alluded to tensions between Carranza and de Blasio in a statement, saying: “Richard Carranza was a real partner in our efforts to open school safely. Too often he had to fight behind the scenes to keep the needs of students, staff and their families ahead of politics. We wish him well. He will be missed.”

During his announcement Friday, while sitting between Carranza and Porter, de Blasio did not say why the change in leadership was occurring now. But he said he admired Carranza. The mayor turned to him and said: “We’ve been through it all together. I think that’s a fair statement.”

De Blasio also noted that the last year has been a difficult one, and said, “It took a toll, and I admire you for everything you have done.”

Desegregation was Carranza’s top priority when he was hired away from the Houston Independent School District in 2018 by de Blasio, who has control of the city’s school system. But he and the mayor fought repeatedly over how to do it.

Recently, the two men this month clashed about the future of gifted and talented classes, according to the New York Times — after which Carranza wrote a resignation letter.

During this fight, the Times said, de Blasio argued for continuing a program that allows 4-year-old students to enter gifted and talented classes through an admissions test until a new system could be announced early next year before he leaves office.

Carranza had long been opposed to the gifted program — which is dominated by White and Asian American students — as well as to admissions tests to special schools and programs, saying they were unfair to hundreds of thousands of students.

Admissions practices to selective programs and schools is one of the reasons that New York City has one of the most segregated school systems in the country.

Carranza will be succeeded by Porter, a veteran educator who since 2018 has been the executive superintendent of the Bronx, with 361 schools and 235,500 students.

She has been a teacher and helped found the Bronx School for Law, Government and Justice, where she stayed for 18 years and served as principal. She later was superintendent of District 11 before her tenure as Bronx executive superintendent, during which high school graduation rates hit an all-time high.

On Friday, Porter said she would work to ensure that every student had educational opportunity.

“Primarily, as chancellor, my job will be to remove the barriers, to direct resources where they are needed most, and communicate clearly around our shared goals and commitments, at every school in every neighborhood in every single borough,” said Porter, who was raised by a single mother who returned to school as an adult and became a teacher.

“I’m ready to hit the ground running and lead the city’s schools to full recovery,” she said, adding that it won’t be an easy task.

Mulgrew praised Porter, saying, “We have successfully partnered with Meisha Ross Porter on projects in the past, including the Bronx Plan and expanding community schools. We look forward to working with her in the future.”

Before running the Houston system, Carranza — the grandson of immigrants from Mexico — had been superintendent in San Francisco for four years, and was previously a bilingual classroom teacher, a school principal and a senior-level administrator in Las Vegas and Tucson.

During his chancellorship, Carranza did not hesitate to publicly comment on controversial subjects.

On Thursday, Carranza caused a stir when he criticized the Biden administration’s decision to require states to administer federally mandated standardized tests this spring during the coronavirus pandemic. The administration allowed states some flexibility about how and when to give the tests.

While news of his coming resignation was not yet publicly known, Carranza made clear that he does not think students should be required to take the tests this year. “As an educator I would say to parents, there is an opt-out,” he said Thursday. “And if there is ever a time to consider whether that opt-out makes sense for you, this is the time.”

New York state early this month asked the U.S. Education Department for a waiver from the federal testing mandate.

In April 2018, a month into his tenure as chancellor, Carranza stoked controversy by tweeting about some wealthy parents in an Upper West Side neighborhood in Manhattan who had been vocal at a meeting about a plan to diversify the public schools there.

He tweeted a story about the meeting with the words: “WATCH: Wealthy white Manhattan parents angrily rant against plan to bring more black kids to their schools.” He later apologized, and said the words in the tweet weren’t his.

correction

An earlier version of the story gave the incorrect first name of the president of the United Federation of Teachers. He is Michael Mulgrew.