The federal government Monday told a judge it will reverse course and take steps to comply with his order to allow girls of any age to buy emergency contraception without prescriptions.

The Department of Justice, in the latest development in a complex back-and-forth over access to the morning-after pill, notified U.S. District Judge Edward Korman it will submit a plan for compliance. If he approves it, the department will drop its appeal of his April ruling.

“Once the court confirms that the government’s understanding is correct, the government intends to file with the Circuit Court notice that it is voluntarily withdrawing its appeal in this matter,” the department said in a letter to the judge.

Last week, the appeals court dealt the government a setback by saying it would immediately permit unrestricted sales of the two-pill version of the emergency contraception until the appeal was decided. That order was met with praise from advocates for girls’ and women’s rights and with scorn from social conservatives and other opponents, who argue the drug’s availability takes away the rights of parents of girls who could get it without their permission.

The government had appealed the judge’s underlying April 5 ruling, which ordered emergency contraceptives based on the hormone levonorgestrel be made available without a prescription, over the counter and without point-of-sale or age restrictions.

It asked the judge to suspend the effect of that ruling until the appeals court could decide the case. But the judge declined, saying the government’s decision to restrict sales of the morning-after pill was “politically motivated, scientifically unjustified and contrary to agency precedent.” He also said there was no basis to deny the request to make the drugs widely available.

The government had argued that “substantial market confusion” could result if the judge’s ruling were enforced while appeals were pending, only to be later overturned.

The morning-after pill contains a higher dose of progestin, a synthetic version of the female hormone progesterone, than is in regular birth control pills. Taking it within 72 hours of rape, condom failure or just forgetting regular contraception can cut the chances of pregnancy by up to 89 percent, but it works best within the first 24 hours. If a girl or woman already is pregnant, the pill, which prevents ovulation or fertilization of an egg, has no effect.

The Food and Drug Administration was preparing in 2011 to allow over-the-counter sales of the morning-after pill with no limits when Health and Human Services Secretary Kathleen Sebelius overruled her own scientists in an unprecedented move.

The FDA announced in early May that Plan B One-Step, the newer version of emergency contraception, the same drug but combined into one pill instead of two, could be sold without a prescription to those age 15 or older. Its maker, Teva Women’s Health, plans to begin those sales soon. Sales had previously been limited to those who were at least 17.

The judge later ridiculed the FDA changes, saying they established “nonsensical rules” that favored sales of the Plan B One-Step morning-after pill and were made “to sugarcoat” the government’s appeal.

He also said they placed a disproportionate burden on blacks and the poor by requiring a prescription for less expensive generic versions of the drug bought by those under age 17 and by requiring those age 17 or over to show proof-of-age identification at pharmacies. He cited studies showing that blacks with low incomes are less likely than other people to have government-issued IDs.