New York City will begin providing paid family leave to teachers, officials announced today, a victory for the United Federation of Teachers.

The city will pay full salary to birth, foster, adoptive, and surrogate parents for six weeks — covering about 120,000 union members. Combined with sick time, birth mothers will now be able to take 12 to 14 weeks of leave starting in September. The city estimates 4,000 parents annually will benefit.

The new policy is expected to cost the city $51 million. To help cover that cost, the city and the union agreed to extend their current contract for an additional two-and-a-half months past its expiration in November.

“It’s a fundamental matter of fairness to make sure that people have this opportunity,” said Mayor Bill de Blasio.

The decision follows heavy pressure from the teacher’s union, which has campaigned for a more generous policy for teachers since the city extended six weeks of fully paid time off to its non-union workforce in 2016, covering about 20,000 managerial employees. Paid leave had become a rare point of contention between the mayor and powerful teachers union — with the union president accusing the administration of sexism during a City Council hearing.

“All we asked for was to be treated fairly when members of our own union bring children into their families,” UFT President Michael Mulgrew said Wednesday. “That wrong has finally been righted.”

The new policy also comes as the UFT braces for a Supreme Court ruling that could take a big bite out of the union’s ability to collect dues. Securing a victory on paid family leave could help demonstrate the union’s utility at a time when retaining members could become increasingly difficult.

Educators who work for the Department of Education, the city’s largest agency, previously had to use accrued sick days after having a baby — and that policy applied only to birth mothers, not educators who become parents through adoption or surrogacy.

The city has contended that the issue would be addressed during negotiations for the UFT contract. But Mulgrew has bristled at that, saying at a hearing in April that leave was “being used completely as a bargaining chip against our union.” The UFT’s membership is 77 percent female.

Top city officials have previously hinted that they planned to come up with a family leave policy, even if they have been reluctant to share details about what it could look like. “Obviously we’re not going to negotiate in public,” Carranza said last month. But, he added, “I will be very supportive of anything that helps [teachers].”

The battle for paid family leave was re-ignited by an online petition started by two Brooklyn teachers that had more than 80,000 signatures in the fall. After the teachers brought attention to the issue, the union took up the cause, sending out an “action alert” to members in November.

“We’ve chosen to dedicate our lives to helping children, so the irony is glaring that we don’t get any support when we’re having our own,” said Emily James, a Brooklyn high school teacher who was behind the viral petition.

Even as strides in family leave have been made elsewhere, union officials said teachers were being left behind. New York state, for example, passed a mandatory paid leave policy that covered private employees as of 2018.

Taking leave under the old policy created hardship for parents. Mothers had to use sick days if they wanted paid time off after giving birth. But teachers earn only one sick day per school month worked: To save up for an eight-week leave, a teacher would have to work about four years without taking a sick day.

If a woman hasn’t accrued enough days, she can “borrow” days that she hasn’t accrued yet, up to 20 days. But if she or her children actually get sick, any days beyond the 20 must be taken unpaid. And borrowed sick days have to be repaid if the teacher leaves the education department.

Monica Disare and Christina Veiga contributed reporting.