The U.S. Supreme Court ruled on Monday for AT&T Inc in a dispute over how retirement benefits should be calculated for women who took maternity leaves before the federal Pregnancy Discrimination Act took effect in 1979.

By a 7-2 vote, the justices overturned a U.S. appeals court ruling that AT&T had violated federal civil rights law by not granting women credit for their entire pregnancy-related leaves taken before 1979.

The 1979 law barred companies from treating pregnancy leaves differently from other disability leaves. Since then, maternity leave has been considered disability leave and has been credited toward retirement.

The ruling was a defeat for four AT&T employees who each took at least one maternity leave between 1968 and 1976 and had sued. AT&T at the time allowed pregnant women up to 30 days of paid leave, but the women lost between 67 and 261 days of uncredited leave.

The appeals court in San Francisco ruled those days of maternity leave should count in determining their pension benefits.

The Bush administration had backed AT&T, saying the appeals court ruling improperly credited maternity leaves before the law took effect and that Congress specifically did not make the law retroactive.

Writing for the court majority, Justice David Souter concluded, We hold there is no necessary violation; and the benefit calculation rule in this case is part of a bona fide seniority system under ... the Civil Rights Act of 1964, which insulates it from challenge.

Justices Ruth Bader Ginsburg and Stephen Breyer dissented.

(Reporting by James Vicini, Editing by Gerald E. McCormick, Dave Zimmerman)