DANVILLE, Ky. — The Danville, Ky., city commission has advanced an ordinance that would make it illegal to discriminate based on sexual orientation or gender identity in cases of employment, housing or public accommodations.

The measure was approved by a vote of 3-2 on its first reading Tuesday after altering the proposed ordinance to exempt religious groups.

The city added the religious exemption after a Baptist-affiliated organization threatened to leave the city, reports The Advocate Messenger.

At the commission’s meeting last month, an attorney for Sunrise Children’s Services said it would move its child care center out of Danville if the ordinance did not include an exemption. The Baptist-affiliated agency receives a significant portion of its funding from the government, but it refuses gay job applicants.

The previous version of the ordinance included an exemption, but only for religious groups that receive less than half of their funding from government sources.