The principal tapped by the city to overhaul troubled Boys and Girls High School will leave after this month, officials said Thursday, continuing a tumultuous series of leadership changes and turnaround attempts at the historic Brooklyn school.

Principal Michael Wiltshire will return full-time to nearby Medgar Evers College Preparatory School, the high-performing school the city allowed him to run at the same time as he worked to revamp Boys and Girls.

The move comes after Wiltshire interviewed for the top job at a Long Island high school. It also follows recent reports that city investigators found Wiltshire had failed to properly report an instance of student-on-student sexual harassment at Boys and Girls. He is also under investigation for a separate matter at Medgar Evers, officials have said.

Wiltshire’s departure delivers a blow to Chancellor Carmen Fariña’s “master principal” strategy, where a single leader is placed in charge of two schools — including, in this case, one that is chronically low-performing and under threat of state takeover. Wiltshire has encountered difficulties at both schools recently: Parents at Medgar Evers rejected his plan to move that school into Boys and Girls’ building, and he clashed with the social-service agency chosen by the city to support Boys and Girls’ neediest students.

It also adds to the uncertainty around the future of Boys and Girls, a Bedford-Stuyvesant institution that is fiercely protected by local politicians but remains one of the worst-performing schools in the state.

The school’s attendance and graduation rates have improved since Wiltshire took over in Oct. 2014, and its suspension rate has fallen sharply. Still, its enrollment has fallen by nearly 50 percent over that period, and 60 percent of its students are considered chronically absent. And Wiltshire’s tactics have raised concerns among some parents and advocates: Within weeks of taking over, dozens of struggling students were encouraged to transfer to other schools, Chalkbeat reported.

Still, Fariña has consistently defended Wiltshire’s performance. On Thursday, an education department spokeswoman said his return to Medgar Evers as its full-time principal was a “mutual decision” by him and the city.

“Dr. Wiltshire’s appointment as master principal was a strategy that helped to stabilize Boys and Girls and put it on a path to improved outcomes,” said the spokeswoman, Devora Kaye, noting that the school’s graduation rate increased 8 percent under Wiltshire.

He will make the move on July 1, Kaye said. Angelo Marra, who was brought on this month to help Wiltshire manage the two schools, will continue to oversee Boys and Girls until a new principal is chosen.

Several names of potential successors are already being floated.

Wiltshire has recommended that he be replaced by his assistant principal at Boys and Girls, who previously worked at Brooklyn Technical High School, according to Albert Vann, a former city councilman and member of Boys and Girls’ influential advisory board. That group, which successfully pushed for Wiltshire’s appointment two years ago, has endorsed his recommendation, Vann said.

Meanwhile, some Boys and Girls alumni and faculty members are lobbying for Allison Farrington, the principal of a school for struggling students that shares a building with Boys and Girls. Her assistant principal at Research and Service High School, Christopher Smith, is also a candidate for the job, according to people at Boys and Girls.