SAN ANSELMO, CA - APRIL 05: A package of Plan B contraceptive is displayed at Jack's Pharmacy on April 5, 2013 in San Anselmo, California. A federal judge in New York City has ordered the Food and Drug Adminstration to make Plan B contraceptive, also known as the morning after pill, available to younger teens without a perscription within 30 days. The judges ruling overturns a December 2011 decision by the FDA to restrict access to the contraceptive to any girl under 17 years of age. (Photo Illustration by Justin Sullivan/Getty Images)

If a guy needs to buy the morning-after pill for a female friend, he's going to need to rely on a fair amount of luck. That's because a study found young men have a nearly 20 percent chance of being denied emergency contraception even though there are no laws preventing them from buying it.

A January study from Columbia University's Mailman School of Public Health sent male "mystery shoppers" to 158 pharmacies in three neighborhoods of New York City to buy emergency contraception, such as Plan B, which is an effective way to avoid an unintended pregnancy in the event of something like rape or a condom breaking during sex. The study found that only 81 percent of the pharmacies would give emergency contraception to the male shoppers. At 19 percent of the pharmacies, the male shoppers couldn't obtain contraception.

This was in New York City -- not Texas or Mississippi, where pharmacists have come under fire in the past for refusing to sell the drug to men.

According to the study, 73 percent of the pharmacies that didn't give emergency contraception to men said they needed to see the woman taking the pill or needed to see her ID card. Twenty-seven percent of them said they didn't have the pills in stock.

In 2013, the Food and Drug Administration lifted age limits on Plan B and made the pill available over the counter. Before then, you had to be 17 or older to get the morning-after pill.

One caveat of the Columbia study is that it was conducted in July 2012, before the FDA's age limits were lifted. Even though all of the subjects in the study were 19 or older, the study notes that the pharmacies that denied men access to emergency contraception because they required the woman or her ID card to be present may have simply been trying to comply with the FDA's age limits.

Dr. David Bell, associate professor of population and family health at the Mailman School of Public Health and one of the authors of the study, said in a release about the study that another possible explanation is that "pharmacists conscientiously objected to emergency contraception overall or its purchase by males."

It's possible pharmacists also wanted to prevent men from coercing their female partners into taking the pill.

"Anecdotally, speaking with a few pharmacists about the results, the request may have been a covert way to determine the presence or lack of coercion in a relationship," Bell said in the release.