A federal judge ruled that the Plan B emergency contraception products must be made available for purchase over the counter without any age restrictions. NBC's Stephanie Gosk reports.

A federal judge on Friday reversed a contentious Food and Drug Administration ruling and ordered the agency to make the so-called "morning-after pill" available without a prescription to all girls of reproductive age, including those younger than 17.

The ruling by U.S. District Judge Edward Korman in Brooklyn, New York, comes in a lawsuit brought by reproductive-rights groups that had sought to remove age and other restrictions on emergency contraception.

Currently, only women aged 17 and or older can obtain emergency contraception without a prescription. For those women, the medication is available only at health clinics or pharmacies and they're required to show identification to obtain it.

The rule requiring girls younger than 17 to obtain a doctor's prescription was confirmed in December 2011, when Health and Human Services Secretary Kathleen Sebelius overruled an FDA recommendation -- and Commissioner Margaret Hamburg -- to force the agency to limit access to emergency contraception for young girls.

In her decision, Sebelius said she wasn't convinced that drug makers had proven that access should be broadened and she expressed concern that girls who reached reproductive maturity at ages as young as 11 could have access to the medication.

At the time, that decision drew intense criticism from medical and women's rights groups, who said that denying access defied strong scientific data that showed that emergency contraception is safe and effective for girls and women of all ages. Sebelius' action was widely seen as a move to protect President Barack Obama's administration from the appearance of encouraging sexual activity in such young girls.

Korman said the FDA's rejection of requests to remove age restrictions to obtain the pill had been "arbitrary, capricious and unreasonable." The 59-page ruling says that Sebelius' actions were "politically motivated, scientifically unjustified and contrary to agency precedent."

The ruling orders the FDA to make levonorgestrel-based emergency contraception available without age or so-called "point of sale" restrictions within 30 days. It appears to apply to all brands of the morning-after pill, although Korman gave FDA the option of limiting the expanded access to the Plan B One-Step single-pill product if the agency "actually believes there is any significant difference between the one- and two-pill products."

Nancy Northup, president of the Center for Reproductive Rights, hailed the ruling. "Women all over the country will no longer face arbitrary delays and barriers just to get emergency contraception," she said.

The group was among those that brought the lawsuit, the culmination of more than a decade of political and legal wrangling.

"Today's court order has swept away all the FDA stalling, all the interference and all the gamesmanship," Northup told reporters in a conference call.

Anti-abortion activists reacted swiftly to the ruling, saying it provided access for vulnerable young girls to drugs that the groups believe induce abortions.

“Teen girls need parents, not unfettered access to abortion-inducing drugs,” said Marjorie Dannenfelser, president of the Susan B. Anthony List. “Judge Korman’s decision is reckless and denies girls the protection that comes along with the involvement of parents and doctors."

The U.S. Conference of Catholic Bishops also opposed the change, saying the court acted "irresponsibly" by making powerful hormonal drugs available without prescription to minors.

"Plan B does not prevent or treat any disease, but makes young adolescent girls more available to sexual predators," said Deirdre McQuade, spokeswoman for the conference, in a statement. "The court's action undermines parents' ability to protect their daughters from such exploitation and from the adverse effects of the drug itself."

A new ruling from a federal judge is ordering that the morning-after pill be available for over-the-counter purchases to girls of all ages, not just to those over the age of 17, as previously ruled.

Meanwhile, news of the ruling was applauded by a range of medical, women's rights and reproductive rights groups.

Dr. Cora Collette Breuner, a Seattle pediatrician and professor of adolescent medicine, said the American Academy of Pediatrics regards the ruling as a victory of science over politics.

"Finally, my children and their children will have access to a product they didn't have before," she said.

Cecile Richards, president of the Planned Parenthood Federation of America, also praised the move.

“Lifting the age restrictions on over-the-counter emergency contraception is a significant and long-overdue step forward for women’s health that will benefit women of all ages," she said in a statement.

The ruling would particularly benefit immigrant women by removing requirements to show identification to buy the drugs, and also by making them available in a wide range of settings, advocates said.

"It's getting EC right on the store shelves, right next to the condoms and the cough medicines, where it belongs," said Kimberly Inez McGuire of the National Latina Institute for Reproductive Health.

FDA spokeswoman Erica Jefferson declined to comment on the ruling, saying it was an ongoing legal matter.

It wasn't immediately clear if the U.S. Department of Justice would appeal the judge's ruling. Allison Price, a department spokeswoman, told NBC News the agency was reviewing the opinion.

In the past, druggists and store owners who regarded the morning-after pill as a form of abortion had refused to dispense or sell the products. It's not yet clear whether some stores would refuse to stock the drugs, or whether they would keep them behind locked counters to dissuade shoplifting. The drugs typically sell for about $50 a package.

Emergency contraception uses high doses of the same hormones used in birth control to prevent pregnancy when taken within 72 hours of unprotected sexual intercourse. Taken in one- or two-pill doses, the product can prevent or delay ovulation, prevent fertilization or, in some cases, prevent implantation of a fertilized egg into the lining of the uterus. It does not cause miscarriages or abortions and would have no effect if a woman were already pregnant, medical experts say.

Related: