A federal district court has ruled in favor of a Kentucky wedding photographer who challenged a Louisville ordinance banning businesses from discriminating against gay customers.

U.S. District Court Judge Benjamin Beaton on Tuesday granted a request by Chelsey Nelson for an injunction against the city’s ordinance, the Courier Journal reported. The order said the city could not use the law to compel her to photograph same-sex weddings or "otherwise express messages inconsistent with Nelson’s beliefs."

Nelson sued Louisville city officials in 2019 - arguing that the city’s so-called fairness ordinance violated the First Amendment because it could force her to take on same-sex wedding assignments, which she opposes due to her religious beliefs. The Louisville ordinance prohibits discrimination based on sexual orientation and gender identity in housing, public accommodations and employment.

KENTUCKY MAN CHARGED IN FATAL SHOOTING OF 12-YEAR-OLD DAUGHTER

Lousiville, Mayfield, Lexington news

A Kentucky judge ruled in favor of a wedding photographer who argued a state discrimination ordinance violated her freedom of speech.

Alliance Defending Freedom attorney Bryan Neihart said in the statement Wednesday that he was happy with the court’s decision.

FORMER KENTUCKY STATE TROOPER CONVICTED OF CONSPIRACY, 2 OTHERS INVOLVED

"We’re pleased the court agreed that the city violated Chelsey’s First Amendment rights. The court’s decision sends a clear and necessary message to every Kentuckian — and American — that each of us is free to speak and work according to our deeply held beliefs," Neihart said.

Louisville Mayor Greg Fischer said in a statement that he disagreed with the court’s ruling and that city officials would likely appeal.

KENTUCKY'S MAMMOTH CAVE NATIONAL PARK TO START IMPROVEMENTS ON UNDERGROUND TRAIL IN FALL

"We are a city of compassion and we appreciate the many ways our LGBTQ+ family contributes to our diverse community," Fischer said. "Louisville Metro Government will continue to enforce to the fullest extent possible its ordinance prohibiting anti-discriminatory practices and will fight against discrimination in any form."