HARRISBURG - Although his yearslong crusade to enact a statewide ban on discrimination based on sexual orientation or gender identity again died at the end of the most recent legislative session, State Rep. Dan Frankel sees reason for optimism.

This time around his bill attracted a record 71 cosponsors, including two Republicans, and even passed narrowly out of the State Government Committee. It then drew hostile amendments from opponents and was not brought up for a floor vote.

With Republicans set to take over the House and governorship next month, Frankel says his effort's short-term prospects are dim, but he insists he's much more hopeful about the long run.

"In my view, it's inevitable," said Frankel (D., Allegheny). "When you talk to people, particularly younger people, under 50, they don't understand why this is an issue."

The legislature's lack of action to outlaw bias in housing, employment, or public accommodation for lesbian, gay, bisexual, and transgender people has helped prompt 18 counties or municipalities across the state to pass their own local human relations ordinances, while about a dozen more are in some stage of considering it.

The issue has arisen most recently in the Philadelphia suburbs, where Doylestown passed an ordinance in August and the Lower Merion Township commissioners adopted one earlier this month.

In Hatboro, the council passed a human relations ordinance in November, but it was vetoed by the mayor, who said the issue was more appropriately handled by state government. Opponents also cited costs and potential litigation.

Pennsylvania's 18 local ordinances vary to some degree, but they generally require a review by a human relations commission and a mediation process and rely on fines, summary charges, or civil litigation for enforcement. Seven also conduct their own investigations.

Twenty-one states have similar laws on the books.

"You can fire someone for being openly gay in Pennsylvania," said Ted Martin with Equality Pennsylvania, an advocacy organization with offices in Philadelphia and Harrisburg. "It's still legal. It's still legal to refuse them public accommodations. Those things, as long as they exist, are wrong."

Opponents note that expanding antidiscrimination protections comes with a price to taxpayers, argue that the incidence of those kinds of bias is relatively infrequent, and say the laws can force a conflict with deeply held religious beliefs.

"It creates a policy, a public policy, and it puts those who disagree with that policy in the same footing as those who are, say, racial bigots," said Randall Wenger, lawyer for the Harrisburg-based Pennsylvania Family Institute, which lobbied against Frankel's bill.