A city's attempt to force churches and other religious groups to align with its gender-identity and sexual-orientation agenda has been slapped down by a judge.

The city of De Pere, Wisconsin, adopted a "non-discrimination" ordinance then designated churches "places of public accommodation."

The city claimed that any time a church is open to the public, outside the role of a house of worship, it is subject to the ordinance.

TRENDING: Dying father gets to see son play football one last time thanks to kindhearted nurse

On Friday, however, Brown County Judge William Atkinson granted a summary judgment to the churches and denied the city's request to dismiss the suit.

Brad Dacus, president of the Pacific Justice Institute, which represented several churches in the lawsuit, said the "unconstitutional ordinance could not go unchallenged."

The ordinance demanded "non-discrimination" on the basis of gender identity and sexual orientation in housing, employment, advertising and public accommodations.

There was no exemption for religious groups.

"These religious organizations stood up for their convictions and fought back against intolerant and aggressive LGBT policies," Dacus said.

"Now churches can continue to advertise, display, or publish teachings and sermons on matters of sexual ethics, divorce, or the biological phenomenon that persons are born either male or female – without the city's oppressive restriction."

PJI said it represented five churches and a radio broadcaster that "bravely held to the biblical beliefs that God determines gender and prohibits homosexuality."

"These pastors, who preach from their pulpits on marriage and sexual ethics, hold their ministries to those biblical standards in areas of community outreach, employment, and advertising," PJI said.

"In the courtroom, De Pere's attorneys even mentioned that actions such as a church serving as a polling place or handing out water to runners at an athletic event triggered the city's provision. If the ordinance had survived, De Pere would be the first in America to deem churches places of public accommodation."

But the judge ruled that, effective immediately, religious institutions are exempt from the ordinance.

"This court victory came just in time for these churches who have treaded cautiously under the burden of this government orthodoxy," said PJI attorney Kevin Snider.

"Our clients and the many other religious institutions in De Pere can fulfill their religious functions and ministries this Christmas season, without fear of being brought before a tribunal due to their hiring choices or refusal to host same-sex marriages on church property."

The case filed was on behalf of Hope Lutheran, Crosspoint, Destiny, St. Mark Lutheran and Christ the Rock churches, as well as a local radio station.

PJI said that because the ordinance "is written so broadly, and is devoid of typical safeguards such as religious employment exceptions, or even the ministerial exception unanimously recognized by the Supreme Court, PJI first sought amendments or assurances that the ordinance would not be interpreted or enforced in ways that impinged on religious freedom."

"The city of De Pere refused to provide any such assurances, leaving the religious institutions vulnerable absent court action," the organization said.

The churches argued the state constitution states that the "right of every person to worship Almighty God according to the dictates of conscience shall never be infringed."