Nine years ago, while men were being drafted and killed in Vietnam, a Philadelphia judge dismissed a suit challenging the military draft. The action went largely unnoticed outside of town for it was just another antiwar protest one among thousands.

On July 18, 1980, a three-judge federal court panel ruled in the same case that draft registration was unconstitutional because it excluded women, sending the issue to the Supreme Court where it may produce a landmark ruling this term.

"Where in the devil," a Justice Department lawyer taken by surprise that July day commented, "did that ruling come from?"

The answer -- how a nine-year-old relic of a case was reborn -- is another strange tale of the legal system, of how it is ruled by luck, as much as by judges, by accidents as well as by precedents.

The case dismissed nine years ago is indeed the same one that produced the July 18 ruling now before the Supreme Court. It started, its backers concede, without a prayer: both the facts and the law were against it. It hung on desperately, by a loophole, all that time, waiting for the facts and the law to change. By luck, they did. In the three-judge panel ruling, the case without a prayer didn't even sound close.

It owes much of its success to the government, which could have brought the case to trial before everything changed. Donald Weinberg, a lawyer for the draft eligible class of men represented in the suit, thinks he might have lost then. Instead, government lawyers, doing what law school students are taught to do for defendants, moved at every step along the way to avoid trial. Then, to make matters worse, the government provided the facts that convinced the judges that the all-male draft was unconstitutional.

The case, as it now stands, challenges the draft registration because it distinguishes between the sexes for no substantial reason. But when a group of draft-eligible war protesters began it on July 16, 1971, in U.S. District Court, sex discrimination was only a minor part, a way of achieving something else.

The suit originally was intended to end the Vietnam war. It challenged the draft as involuntary servitude (slavery), a violation of due process and of the right of free expression and as an illegal tool of an unconstitutional war. t

Judge James H. Gorbey quickly dismissed the suit, sending it, he must have thought, to that same never-never land where most of the other antiwar suits were put to rest.

The plaintiffs appealed and on May 11, 1973, the 3rd U.S. Circuit Court of Appeals in Philadelphia agreed with Gorbey that most of the claims should be thrown out. One, the sex discrimination component, should be preserved, the court ruled, simply because there had been no prior rulings on which to base a dismissal. Gorbey then approved the sex discrimination count for consideration by a three-judge panel.

Had there been a trial at this point, it might have ended quickly. By 1974, for one thing, there was no draft. If there was no draft, there might be no case. Only an obscure provision of the 1949 draft law -- making men previously deferred from the draft eligible; until their 35th birthday -- was used to keep it a barely live controversy.

But even if there had been a draft law still on the books, the nation's courts had never made it illegal to distinguish between men and women in the law. In 1974, legislatures and Congress could, with little justification, deny almost anything on the basis of gender. There was no legal precedent to throw out the draft, or anything else, because women were excluded.

But in a totally unrelated case (Craig Vs. Boren) in 1976, the Supreme Court changed all that. From then on, the court ruled, distinctions between men and women in the law would have to be "substantially related to an important government interest."

To judges, the new language was critical, just short of enactment of the Equal Rights Amendment. To the government, it was potentially devastating. e

Government lawyers would now have to show that the exclusion of women from the draft by Congress was based on an important reason. Vague justifications, stereotypes, were no longer adequate. And the justifications for excluding women in the draft law were laced with stereotypes.

When Congress enacted the original draft legislation in 1949, as a judge in the 1980 case would describe it, there was "an aura of male chauvinism permeating congressional attitudes toward women in the military."

Here, for example, is Rep. James E. Van Zandt (R-Pa.) in 1948 discussing a reason for not letting women command men in the military. "There is not a member of the House Committee on Armed Services," Van Zandt said during one hearing, "who has not received a telephone call or a call in person from enlisted men objecting to the idea of having to take orders from a WAVE officer. Put yourself in the position of an enlisted man and I am sure you will agree with them."

And here is then-Gen. Dwight D. Eisenhower expounding before a congressional committee on how the committee members did not have to worry about expenditures for pensions for women in the military. Few women will ever become eligible by serving their full 30 years, he said. "They will ordinarily -- and thank heaven -- they will ordinarily get married" and leave the service.

The antidraft lawyers dug up all the material from the 40s and put it in the record.

The government would still argue that the affairs of the military are exempt from the Supreme Court's new standard for reviewing distinctions based on gender. And even if the military was not exempt, there was still a substantial reason that could pass muster under the new standard: military flexibility.

"To replace combat-capable males with combat-barred females denies the military the flexibility it obtains through an all-male draft and conscription," the government argued.

Had the case gone to trial, instead of being delayed, there would have been little data available to the plaintiffs with which to dispute the government's argument.In the end, however, the government did their work for them.

It was the winter of 1979 and lawyer Weinberg recalls feeling pessimistic about the chances for keeping the case alive. There was still no draft and he felt the judges were skeptical about allowing the case to continue.

"You never know when the draft might be reinstated," Weinberg recalls telling one of the judges during a private conference, trying anything to convince him the case was still relevant. "You never know when there might be some kind of invasion."

A few weeks later, in December last year, the Soviet Union invaded Afghanistan. President Carter announced reinstitution of draft registration and one of the judges joked to Weinberg: "You must have a pipeline to Brezhnev."

That saved the case. But it didn't make the case. That was left, once again, to the government. In the years of the case's delay, the utilization of women in the military increased dramatically, from 39,000 at the beginning to over 150,000 by 1979. The military was quietly studying female effectiveness and finding, for example, that properly trained women could load 95-pound shells into 155 mm howitzers just effectively as men. The Army instructed field commanders to allow women full battlefield access in the event of war, removing many, though not all, of the old restrictions.

Finally, when the president proposed that women be included in the new draft, the administration hauled out top Pentagon officials to support this position before a skeptical Congress.

The "work women in the armed forces do today is essential to the readiness and the capability of the forces," Assistant Defense Secretary Robert B. Pirie told Congress. "It is in the interest of national security that, in an emergency requiring the conscription for military service of the nation's youth, the best qualified people for a wide variety of tasks in our armed forces be available. The performance of women in our armed forces supports the conclusion that many of the best qualified people . . . will be women."

This type of testimony would ultimately decide the case. And an extraordinary public admission by a Justice Department lawyer during those hearings would put the nail in the coffin.

Larry L. Simms, deputy assistant attorney general (he works for the agency arguing against the draft in Philadelphia), told members of Congress that the historical record -- the male chauvinist comments in 1948 and 1949 -- were so devastating that a whole new, after-the-fact record would be required to defend the all-male draft.

As a result of Simms' testimony, the judges decided it wasn't even worth exploring in depth the 1948 legislative history to find a reason for excluding women.

In their opinion, the three judges based their ruling in large measure on government testimony. Military experts had testified, they recalled, that women are necessary in the event of an emergency callup. They had testified that women have been "a success story" in the military.

"The principal reason the government proffers for a male-only registration," the court said, "is that it provides military flexibility. We therefore hold that the complete exclusion of women from the pool of registrants does not serve 'important governmental objectives' and is not 'substantially related' to any alleged government interest."