The Utah Supreme Court said a religious group was premature in suing Salt Lake City over its denial to grant a permit allowing a downtown homeless mission to operate.

In a ruling issued Tuesday, justices upheld the dismissal of a suit filed by the Salt Lake City Mission and Pastor Wayne Wilson against Salt Lake City.

The ruling comes after a long-standing legal battle between the mission and the city over the placement of a church mission that city officials say was being used as a homeless shelter against city code.

City officials shut down the Salt Lake City Mission, saying the church was not permitted to house the homeless overnight and did not have a shelter permit. The church was located near The Gateway area of the city.

Wilson said his group considers feeding, clothing and otherwise helping the homeless to be an integral part of their religious worship.

The mission applied on several occasions for a conditional-use permit, but was denied by the city. The mission ultimately sued the city, claiming religious discrimination.

However, justices noted that the mission failed to fully appeal the city's initial decisions and that the group prematurely filed suit. The law states that a person seeking remedy from a court must prove they have fully exhausted all their options with a governmental entity.

The Salt Lake City Mission had caused some controversy among the homeless aid community. In 1998 the director of the Rescue Mission of Salt Lake expressed concern when the former Spectacular Ministries of the Lord's Servants changed its name to the Salt Lake City Mission. The Salt Lake City Mission was accused of changing its name to divert Rescue Mission of Salt Lake's charitable contributions.

Wilson created the church after he said he found Christ while serving 10 years at the Utah State Prison on what he claims were trumped-up sex-abuse charges. He opened up his mission soon after he was paroled in 1994. Shortly after that, city officials protested the operation, and ultimately Wilson's lease for the building next to The Gateway was canceled. Wilson has denied that the name change was designed to cut into the other mission's donations.

Wilson's group now operates a mission for men in West Valley City and a ranch in the west desert.