A federal judge granted an injunction this weekend that prevents the government from enforcing the ObamaCare mandate requiring religious groups across the country to provide insurance that includes access to the morning-after pill and other contraceptives.

The preliminary injunction, issued in an Oklahoma City federal court, is based on a class-action lawsuit filed in October by 187 ministries.

The court order Friday came just days before ObamaCare coverage begins January 1, which could have resulted in the ministries facing thousands of dollars a day in tax penalties.

The groups provide employees with health benefits through GuideStone Financial Resources, the health benefits arm of the Southern Baptist Convention.

“This is an overwhelming victory for GuideStone and the nearly 200 plaintiffs in this class-action lawsuit,” said Adele Keim, a lawyer for GuideStone and the Becket Fund for Religious Liberty -- a non-profit, public-interest law firm that helped represent the ministries in the case.

“Today’s ruling will allow hundreds of Baptist ministries to continue preaching the Gospel and serving the poor … without laboring under the threat of massive fines,” she said.

An attorney for the government, Benjamin J. Berwick, did not immediately return a telephone call seeking comment.

The injunction will prevent the government from enforcing the mandate as the suit makes its way through the legal system. However, the groups still must comply with all of the other ObamaCare regulations.

In the lawsuit, the ministries object to providing four out of 20 Food and Drug Administration-approved contraceptives, including the morning-after pill and the week-after pill, which they allege may cause early abortions.

The groups include Reaching Souls International, which trains pastors and cares for orphans in Africa, India and Cuba, and Truett-McConnell College, a Georgia Baptist college.

In his 16-page decision, Judge Timothy DeGiusti said the ministries have the right to challenge the health care law's contraceptive mandate and that an injunction is needed to prevent the federal government from enforcing it on them.

The lawsuit is similar to one filed in Oklahoma City last year by Hobby Lobby Stores, Inc., which calls itself a "biblically founded business." That lawsuit also challenges the mandate that employers provide coverage for the morning-after pill and similar drugs. In July, a federal judge granted a temporary exemption to the Oklahoma City-based arts and crafts chain, a ruling the government has appealed to the U.S. Supreme Court.

Hobby Lobby's lawsuit claims the government mandate is forcing the Christian family that owns the chain "to violate their deeply held religious beliefs under threat of heavy fines, penalties and lawsuits." Failure to provide the drugs in the company's health insurance plan could lead to fines of up to $1.3 million a day, the company said.

Hobby Lobby's owners have said they believe life begins at conception, and they oppose birth control methods that can prevent implantation of a fertilized egg in the uterus, such as an intrauterine device or forms of emergency contraception.

DeGiusti repeatedly referred to the Hobby Lobby case in his ruling and said the ministries who refuse to provide the contraceptives also "face substantial financial penalties, and their refusal will cause a substantial financial loss to GuideStone if it excludes nonexempt, noncompliant organizations from the GuideStone plan."

"Here, as in Hobby Lobby, the court finds that plaintiffs have made a threshold showing of a substantial burden, and, thus, a likelihood of success," the ruling states.

The Associated Press contributed to this story.