An Alabama judge has voided a state law from 2017 that prevented the removal or alteration of historic memorials.

The ruling says it infringes upon citizens' free-speech rights and enshrines a pro-Confederacy message.

It is the latest blow in an ongoing national fight over memorials to the pro-slavery Confederacy, which lost in the 1861-1865 U.S. Civil War.

Backers of the monuments call them a tribute to history and heritage, while opponents decry them as powerful tributes to institutionalized racism.

The ruling resolves a year-long legal dispute in which Alabama sued the Birmingham city government to stop the city from trying to remove an obelisk dedicated to Confederate veterans from a downtown park.

(Reuters) - An Alabama judge has voided a 2017 state law preventing the removal or alteration of historic memorials, saying it infringed citizens' free-speech rights and effectively enshrined a pro-Confederacy message in the southern U.S. state.

The ruling was the latest blow in an ongoing national fight over memorials to the pro-slavery Confederacy, which lost in the 1861-1865 U.S. Civil War. Backers of the monuments call them a tribute to history and heritage, while opponents decry them as powerful tributes to institutionalized racism.

Jefferson County Circuit Judge Michael Graffeo issued the ruling on the Alabama Memorial Preservation Act late on Monday, the last day of his term.

"Under the act, however, the people of Birmingham cannot win," Graffeo said in the court ruling. "No matter how much they lobby city officials, the state has placed a thumb on the scale for a pro-Confederacy message, and the people, acting through their city, will never be able to disassociate themselves from that message entirely."

The ruling resolves a year-long legal dispute in which Alabama sued the Birmingham city government to stop the city from trying to remove an obelisk dedicated to Confederate veterans from a downtown park. The city eventually covered it with wooden boards.

The ruling blocks the state from enforcing the law, though state officials could appeal. A representative from the Alabama Office of the Attorney General did not immediately respond to a request for comment.

Graffeo said in his ruling that the citizens of Birmingham, which is majority black, are guaranteed a right to free speech and that the act infringed on the city's right to engage in a specific, expressive message.

He said the act violated the Fourteenth Amendment, which prevents states from restricting the rights of citizens, because the law issued a fine of at least $25,000 for any attempted removal and alteration of historical monuments.

Separately, the University of North Carolina on Tuesday removed the remainder of a Confederate monument called Silent Sam nearly five months after protesters knocked it over.

"I appreciate the Chancellor's actions to keep students and the public safe," said North Carolina Governor Roy Cooper in a statement. "North Carolina is welcoming to all, and our public university should reflect that."

(Reporting by Gina Cherelus in New York; Editing by Scott Malone and Bernadette Baum)