A Travis County district court ruled Thursday that Austin violated the state's open carry law by barring residents from bringing firearms into its city hall — a blow to Austin officials who have long argued that the ban was admissible under the law's "government court" exception.

At issue is whether certain government agencies are exempt from the state's open carry law, passed in 2015, which allows Texans with a license to openly tote their handguns in a hip or shoulder holster. The law has an exemption prohibiting firearms "on the premises of any government court or offices utilized by the court," unless a written regulation or the individual court authorizes it.

Austin maintained its city hall was eligible for the exemption because it conducts court proceedings there and "maintains office for court personnel." But in July 2016, Texas Attorney General Ken Paxton sued the city, arguing that Austin City Hall does not qualify for the exemption and shouldn't post signs banning licensed carriers from carrying in the building or on the premises. In his suit, Paxton said a citizen previously complained that signs displayed at the city hall building in downtown Austin prohibited licensed firearms, and that people were being given oral warnings against the carrying of handguns on the premises.

“I will always make sure that governments do not trample on the Second Amendment rights of Texans, and if they do, we will sue,” Paxton said in a statement at the time.

In Thursday's ruling, the court ordered Austin to pay a $9,000 fine to the state, consisting of $1,500 for each day it prevented investigators from the attorney general's office from carrying their firearms. It's not immediately clear whether the city will appeal the ruling.

In a statement, Paxton lauded the court's decision.

"The district court’s ruling preserves and protects the Second Amendment rights of Texans and sends a strong message to the city of Austin that they are bound by the same laws as all other Texans," Paxton wrote. "The city of Austin cannot violate the open carry law or any other law the Texas Legislature has enacted simply because they disagree with it."

A spokesman for the city of Austin said it would continue to ban handguns from city hall during times that the building hosts school activities, acts as a polling place or a court facility or is holding a council meeting, "all of which meet the state Legislature’s conditions for restricting the carrying of handguns."

"We will be amending our communications to clarify when our handgun ban will be in effect," the spokesman said.