The education department is reversing course and giving twins and some siblings preference in middle school admissions this year in Brooklyn’s District 15, officials announced Friday.

Parents of twins had led a campaign for sibling priority after District 15 implemented a new admissions policy to integrate middle schools. The new lottery-based admissions policy has improved racial and socioeconomic integration in the district — spanning Cobble Hill to Red Hook, Park Slope to Sunset Park — but parents of twins said it made it harder for their children to stay together, creating logistical headaches for families.

The announcement came just hours after a parent pressed Mayor Bill de Blasio on the issue during his weekly radio appearance on WNYC.

“I’m a single parent, sole parent of twin girls. I can’t send them to two different schools in September,” the parent said, explaining the hardship of sending their children in different directions.

“This is a really serious real-life issue for a family, for any family and particularly for a single-parent family,” de Blasio conceded.

The city’s elementary schools have sibling priority, but middle schools do not. Though there was no middle school sibling priority under District 15’s previous admissions system, individual schools had more influence over how to admit students and could decide whether to offer siblings priority, families said.

Several parents launched an online petition and lobbied local elected officials, who issued a letter calling for an admissions preference that would also extend to other siblings. Even schools Chancellor Richard Carranza, himself a twin who attended college alongside his brother, indicated an openness to this change.

The education department said it would pilot a new policy allowing families with twins in fifth grade who submit identical applications to request an offer to the same District 15 middle school. It also applies to current fifth-grade students who have a sibling in sixth grade at a District 15 middle school to have a priority to attend that school.

“Please note, this pilot is for this current admissions cycle only, and will be re-evaluated before the next admissions cycle,” the letter to district families said. “There is no guarantee there will be a similar priority next year or in any future years.”

The sibling policy does not change District 15’s other admissions priorities, the letter stated, noting that 52 percent of seats in the incoming sixth-grade class will continue to be prioritized for students from low-income families, English language learners, and students in temporary housing.

Though the change came after middle school admissions were due, twins families celebrated the new policy.

About 50 District 15 families with twins will be affected, according to estimates shared with the integration working group members. Another 80 families could benefit from the sibling priority.