(CNN) -- A federal judge on Thursday struck down the federal statute that established the National Day of Prayer, ruling that it violates the constitutional ban on government-backed religion.

"[I]ts sole purpose is to encourage all citizens to engage in prayer, an inherently religious exercise that serves no secular function," a Wisconsin judge wrote in the ruling, referring to the 1952 law that created the National Day of Prayer.

"In this instance, the government has taken sides on a matter that must be left to individual conscience," wrote the judge, Barbara B. Crabb.

The injunction against the National Day of Prayer will not take effect until the defendants in the case, President Obama and White House Press Secretary Robert Gibbs, have exhausted their appeals, the decision said.

The Obama administration said in a Twitter message on Thursday that Obama intends to recognize this year's National Day of Prayer, which is May 6.

The White House press office referred a question about whether the administration would appeal the ruling to the Justice Department, where a press officer was unavailable for comment.

Conservative religious groups called on the White House to appeal the decision.

"The National Day of Prayer provides an opportunity for all Americans to pray voluntarily according to their own faith and does not promote any particular religion or form of religious observance," said Joel Oster, senior legal counsel for the Alliance Defense Fund.

Church-state separation groups, meanwhile, applauded the ruling.

"This decision is a tremendous victory for religious liberty," said the Rev. Barry W. Lynn, executive director of Americans United for Separation of Church and State. "Congress has no business telling Americans when or how to pray."

The Interfaith Alliance also welcomed the ruling. "Maintaining clear boundaries between religion and government only serves to strengthen both," said the group's president, the Rev. Welton Gaddy.

One constitutional scholar doubted the case would survive an appeal to a federal circuit court.

"Judges have never been absolutists in these establishment clause cases," said Douglas Laycock, a University of Michigan Law School professor specializing in religious liberties issues. "If they were they would to tell the president to stop issuing Thanksgiving proclamations and tell the Treasury Department to take 'In God We Trust' off our money."

The lawsuit against the Obama administration was brought by the Freedom From Religion Foundation, a group based in Madison, Wisconsin.

The statute that established the National Day of Prayer calls on the president to annually designate one day, other than a Sunday, "on which the people of the United States may turn to God in prayer and meditation at churches, in groups and as individuals."

The law was amended in 1988 to designate the first Thursday in May as the annual National Day of Prayer.

The event has been celebrated more ostentatiously by Republican than Democratic White Houses, partly because it has become aligned with religious conservatives. Since 1991, the National Day of Prayer Task Force has been led by Shirley Dobson, wife of conservative evangelical broadcaster and activist James Dobson.

Shirley Dobson criticized the Obama administration last year for forgoing the White House celebrations that marked the National Day of Prayer under President George W. Bush. But Obama did issue an official proclamation designating a National Day of Prayer.

"Throughout our nation's history," Obama's proclamation read, "Americans have come together in moments of great challenge and uncertainty to humble themselves in prayer."