(CNN)As controversy mounted about removing Confederate monuments from public spaces across the United States, Alabama passed a law in 2017 that protected them.
But this week a judge overturned the Alabama Memorial Preservation Act, a law meant to prevent the removal, relocation, or alteration of historical monuments.
A 10-page ruling, issued by Jefferson County Circuit Judge Michael Graffeo, said the law violated the free-speech rights of communities. "A city has a right to speak for itself, to say what it wishes, and to select views that it wants to express," Graffeo wrote.
The ruling came after Alabama Attorney General Steve Marshall sued the city of Birmingham for covering up the inscription on the base of a 52-foot monument from 1905 that honors Confederate veterans.
"The City of Birmingham does not have the right to violate the law and leaves my office with no choice but to file suit," Marshall said at the time.
According to the act, any entity that makes changes without permission could be fined $25,000 for each violation.
Graffeo not only ruled that the city had the right to cover up the monument but said the fine could not be enforced as it is unconstitutional.
"The act also violates the Fourteenth Amendment to the U.S. Constitution because it deprives the city of property without due process of law," Graffeo wrote in the ruling. The judge noted that the state has the right to appeal.
CNN reached out to the attorney general for comment but did not immediately receive a response.