Women may buy the morning-after pill without a prescription — but only with proof they're 18 or older, federal health officials ruled Thursday, capping a contentious 3-year effort to ease access to the emergency contraceptive.

Girls 17 years old and younger still will need a doctor's note to buy the pills, called Plan B, the Food and Drug Administration told manufacturer Barr Pharmaceuticals Inc.

The compromise decision is a partial victory for women's advocacy and medical groups that say eliminating sales restrictions could cut in half the nation's 3 million annual unplanned pregnancies.

The pills are a concentrated dose of the same drug found in many regular birth-control pills. When a woman takes the pills within 72 hours of unprotected sex, they can lower the risk of pregnancy by up to 89%. If she already is pregnant, the pills have no effect.

Barr has said it hopes to begin non-prescription sales of Plan B by the end of the year. The pills will be sold only from behind the counter at pharmacies — so the pharmacist can check photo identification — but not at convenience stores or gas stations.

There isn't enough scientific evidence that young teens can safely use Plan B without a doctor's supervision, Dr. Andrew von Eschenbach, the FDA's acting commissioner, said in a memo obtained by The Associated Press.

But Barr did prove that over-the-counter use is safe for older teens and adults — and licensed pharmacies are used to checking for proof of age 18 before selling tobacco and certain other products, von Eschenbach wrote in explaining the agency's age cutoff.

"This approach should help ensure safe and effective use of the product," he concluded.

Plan B's maker was disappointed that FDA imposed the age restriction and pledged to continue trying to get the agency to try to eliminate it.

"While we still feel that Plan B should be available to a broader age group without a prescription, we are pleased that the agency has determined that Plan B is safe and effective for use by those 18 years of age and older as an over-the-counter product," said Bruce L. Downey, Barr's chairman.

As a condition of approval, Barr agreed to track whether pharmacists are enforcing the age restriction, by, among other things, sending anonymous shoppers to buy Plan B. FDA said that Barr is to conduct that formal tracking at least twice in the first year of sales and annually thereafter, and report stores that break the rules to their state pharmacy licensing boards.

But Barr also will conduct a national education campaign to raise awareness of emergency contraception, among both women and health providers.

I have always defined a compromise as a resolution with which no one is happy. I predict that this will meet that definition. Still, it is a step in the right direction.