A federal judge on Friday ordered that the most common morning-after pill be made available over the counter for all ages, instead of requiring a prescription for girls 16 and younger. But his acidly worded decision raises a broader question about whether a cabinet secretary can decide on a drug’s availability for reasons other than its safety and effectiveness.

In his ruling, Judge Edward R. Korman of the Eastern District of New York accused the Obama administration of putting politics ahead of science. He concluded that the administration had not made its decisions based on scientific guidelines, and that its refusal to lift restrictions on access to the pill, Plan B One-Step, was “arbitrary, capricious and unreasonable.”

He said that when the Health and Human Services secretary, Kathleen Sebelius, countermanded a move by the Food and Drug Administration in 2011 to make the pill, which helps prevent pregnancy after sexual intercourse, universally available, “the secretary’s action was politically motivated, scientifically unjustified, and contrary to agency precedent.”

Ms. Sebelius said at the time that she was basing her decision on science because she said the manufacturer had failed to study whether the drug was safe for girls as young as 11, about 10 percent of whom are physically able to bear children. But her decision was widely interpreted as political because emergency contraception had become an issue in the abortion debate and allowing freer access for adolescents would prompt critics to accuse the president of supporting sexual activity for girls of that age.