CHICAGO - An Illinois appellate court Friday affirmed a lower court finding that the state cannot force pharmacies and pharmacists to sell emergency contraceptives - also known as "morning after" pills - if they have religious objections.

In 2005, former Illinois Gov. Rod Blagojevich mandated that all pharmacists and pharmacies sell "Plan B," the brand name for a drug designed to prevent pregnancy following unprotected sex or a known or suspected contraceptive failure if taken within 72 hours.

Some anti-abortion advocates object to the drugs, which work by preventing the release of an egg, preventing fertilization or stopping a fertilized egg from attaching to the uterus.

College vending machine dispenses 'morning after' pill

In 2011, an Illinois judge entered an injunction against the rule, finding no evidence that the drugs had ever been denied on religious grounds, and that the law was not neutral since it was designed to target religious objectors.

The Illinois appellate court agreed that the Illinois Health Care Right of Conscience Act protects pharmacists' decision not to dispense the contraceptives due to their beliefs.

Free birth control under health law begins

"This decision is a great victory for religious freedom," said Mark Rienzi, senior counsel for the Becket Fund, quoted in a statement about the decision.

President Obama's health care reform is drawing fire from Republicans, as provisions enacted today mandate all employers provide free contraception to their employees. NBC's Brian Mooar reports.

Earlier this year, a federal court in Washington struck down a similar state rule, according to the Becket Fund, a non-profit law firm.

The American Civil Liberties Union of Illinois, which had filed an amicus brief on behalf of the state, expressed dismay at the court's decision.

Long-term contraceptives, like IUDs, gaining popularity

"We are dismayed that the court expressly refused to consider the interests of women who are seeking lawful prescription medication and essentially held that the religious practice of individuals trumps women's health care," said ACLU spokesman Ed Yohnka. "We think the court could not be more wrong."

A spokesperson for Illinois Governor Pat Quinn was not immediately available for comment.

Read more health news on NBC's Vitals

More content from NBCNews.com:

Follow US News from NBCNews.com on Twitter and Facebook