SALT LAKE CITY -- A federal judge has awarded the movie theater/bar Brewvies more than $478,000 in legal fees in a ruling that also slammed the Utah State Legislature for passing an unconstitutional law.

In an order handed down on Wednesday, U.S. District Court Judge David Nuffer criticized the state while addressing complaints the litigation had an "unfortunate effect" on taxpayers, who would have to pay for the loss.

"While the effect of attorneys’ fee awards on the public treasury is something that the State may properly consider in enacting, enforcing, and defending legislation, that effect has nothing to do with the reasonableness of Brewvies’ attorneys’ fees. The political judgment of the State that it will enact a statute contrary to existing law and risk payment of legal fees is a legitimate choice, but it has consequences," Judge Nuffer wrote, adding:

"As long as the legislature passes laws which the attorney general is obligated to defend, the financial risks to the State and taxpayers will continue. Legislative enactment of constitutional legislation – and abandonment or non-enforcement of unconstitutional legislation – is a better way to avoid this type of fee award."

The ruling effectively ends a lawsuit that centered around the Salt Lake City movie theater, which faced revocation of its liquor license last year for showing the movie "Deadpool." Utah liquor laws forbade licensees from showing anything with full nudity or sexually explicit conduct. Brewvies had previously faced trouble for showing "The Hangover Part II," "Ted 2" and "Magic Mike XXL."

Brewvies sued Utah’s Department of Alcoholic Beverage Control, arguing the law violated its First Amendment free speech and expression rights. Judge Nuffer ruled in favor with Brewvies and struck down the law.

The law impacted other venues. The Eccles Theater in downtown Salt Lake City was prohibited from allowing patrons to take beer into the theater during the “Book of Mormon” because there was simulated genitalia in the show.

Earlier this year, the Utah State Legislature passed a law modifying the statute to reflect the ruling and include a definition of "artistic expression." It would allow Brewvies and similar theaters to show films like "Deadpool." (The law does not apply to strip clubs.)

Read the judge's ruling here (refresh the page if the document doesn't immediately load):