A federal court ruling Friday requiring the government to make the morning-after pill available to females of any age without a prescription reignited a politically fraught debate that has stretched for more than a decade, vexing two administrations.

In a 59-page ruling, U.S. District Judge Edward Korman in New York offered a scathing rebuke of the 2011 decision by Health and Human Services Secretary Kathleen Sebelius to bar over-the-counter sales of the pill to girls younger than 17. Sebelius had overruled a recommendation from the Food and Drug Administration, which had found the emergency contraceptive was “safe and effective in adolescent females” and could be used properly by young women without consulting a doctor.

Plan B is available to teenagers younger than 17 only with a prescription. Older women must request it from a pharmacist. If Korman’s ruling stands, the product would be available to women of all ages and would no longer be placed behind the pharmacy counter. The judge ordered the FDA to lift the age restrictions within 30 days. The Obama administration has not said whether it will appeal the ruling.

Korman called Sebelius’s decision “politically motivated, scientifically unjustified, and contrary to agency precedent.”

He also accused the FDA of acting in “bad faith” after years of delays on a citizen petition asking that the drug, known as Plan B, be made available over the counter without a prescription.

“More than twelve years have passed since the citizen petition was filed and eight years since this lawsuit commenced. The FDA has engaged in intolerable delays,” Korman wrote, saying its actions amounted to “an administrative agency filibuster.”

Women’s health advocates and major medical groups were quick to praise Friday’s ruling, saying it would help prevent unwanted pregnancies and remove unnecessary hurdles that often prevent teenagers from getting the pill in a timely manner.

“Science has finally prevailed over politics, to the benefit of millions of women across the United States,” Nancy Northup, president of the Center for Reproductive Rights, which initiated the lawsuit on the morning-after pill in 2005, told reporters. “Today’s court order has swept away all the FDA’s stalling, all the interference, and all the political gamesmanship. No longer will women who need emergency contraception have to clear all manner of hurdles to get it.”

Meanwhile, antiabortion activists called the decision short-sighted, saying it could lead to more unprotected sex among teenagers, while also lowering the number of sexually active teens who are likely to discuss such issues with their parents or a doctor.

“It’s common sense to think that if young people are sexually active, they should be talking to their parents, they should be talking to medical professionals,” said Jeanne Monahan, head of the country’s largest antiabortion gathering, March for Life. “I see us going down a slippery slope . . . I don’t think it’s in the best interest of young women’s public health.”

White House press secretary Jay Carney said Friday that President Obama continues to support Sebelius’s decision, but he offered little hint of whether the administration would fight the ruling.

“The Department of Justice is reviewing the appellate options and expects to act promptly,” said department spokeswoman Allison Price. An FDA spokeswoman said the agency had no comment.

In December 2011, Obama said he was not involved in Sebelius’s decision to override the FDA’s opinion that the contraceptives should be available to people of all ages without a prescription. But, he added, “as the father of two daughters, I think it is important for us to make sure that we apply some common sense to various rules when it comes to over-the-counter medicine.”

That explanation did little to quell outrage from those who supported relaxing the restrictions to help women of any age prevent unwanted pregnancies. Many of those groups argued that the administration had made a politically driven decision in an effort to appease conservative, religious voters and antiabortion advocates heading into an election year.

Plan B is classified by the FDA as an emergency contraceptive and greatly reduces the chance of pregnancy if taken within 72 hours after intercourse. It differs from abortion drugs such as RU486, which is intended to terminate a pregnancy that already has been established.

Plan B for more than a decade has seen a number of obstacles in obtaining federal approvals. Multiple government officials have resigned over the issue and, because of the infighting, a complicated web of regulations now exists around the product.

The FDA first approved Plan B as a prescription emergency contraceptive in 1999. In 2003, its manufacturer asked the FDA to make the drug available over the counter. The FDA rejected that request, citing a lack of data on how the drug affected young teenagers.

In 2005, two FDA officials resigned when the agency announced plans to indefinitely postpone any further review of allowing Plan B to be sold over the counter. Within a year, however, the agency decided it would allow women older than 18 to purchase the drug without a prescription, although they would still need to request it from the pharmacist.

Susan Wood, former director of the FDA’s Office of Women’s Health and one of the officials who resigned in 2005, thinks the changing political landscape could finally put an end to the decade-long controversy.

She cites the White House’s decision to require employers to provide contraceptives without co-pay, part of the Affordable Care Act, as evidence that expanding birth control access can be a winning issue.

“I think we’re now in a place where hopefully even folks in the political realm appreciate the fact that contraceptives are something that men and women support,” she said. “Most Americans don’t see this as controversial.”

Scott Wilson contributed to this report.