A man waves a rainbow flag in anticipation of a ruling on same-sex marriage from the Supreme Court in 2015. (Bill O'Leary/The Washington Post)

After years of playing defense in the states, LGBT advocates could be on the verge of a major milestone: They might get through this state legislative session without a single bill they oppose becoming law.

That would be no small thing. Every year for the past couple of years, the community has been playing whack-a-mole with legislation that restricts where they can use the bathroom, where they can live, if businesses can refuse to serve them, and most recently, whether they can adopt children.

Most famously, North Carolina passed the first-ever bathroom bill in 2016 that ultimately cost its Republican governor his job. Texas got close last year to passing one, too. Texas, Alabama and South Dakota have recently allowed adoption agencies to refuse to place children with gay people. Those were just several of a dozen new state laws last year that LGBT advocates said were discriminatory.

But despite more than 120 LGBT-unfriendly bills introduced across the country this year, advocates from the Human Rights Campaign say not a single one has passed. An adoption-refusal bill died in Kansas. In New Hampshire, an attempt to add sexual reassignment therapy as a definition of child abuse failed. In Georgia, for the fifth year in a row, all legislation LGBT advocates opposed was defeated, said Amanda McLain-Snipes with the Equality Federation.

On the bathroom front, only one bill in the United States advanced beyond a legislative committee. That was in Tennessee, but it more or less died when the companion bill in the Senate didn't even get seconded on a motion to be debated. “It appears, for all intents and purposes, that the only anti-transgender bill to receive a committee hearing this year is dead,” said Cathryn Oakley, the state legislative specialist with the Human Rights Campaign.

Instead of lamenting new laws, LGBT advocates are celebrating some. Washington state banned conversion therapy for minors, a controversial practice aimed at changing someone's sexual orientation. Maryland sent a bill this week to its governor to do the same. By the end of this legislative session season, more than a dozen states and the District of Columbia will be likely have banned it.

Advocates aren't out of the woods yet. There are still some 30 state legislatures in session, and they are nervously watching two bills in particular. Oklahoma and Kansas are rapidly moving bills that could allow religious adoption agencies to refuse to place children with gay people.

But advocates have a couple of theories for why this legislative session has been less of a battle for them than those of previous years. The first can be summed up in two words: Pat McCrory. The former North Carolina governor became the first governor in the state's history to lose reelection after becoming the face of the first-in-the-nation bathroom bill. Businesses, sports and Hollywood cut off their ties with the state. After his loss, the GOP-controlled state legislature moved to repeal it.

After North Carolina, passing bills that LGBT advocates oppose is becoming a business decision for a state as much as a cultural and political one.

In Texas last year, a bathroom bill was defeated after powerful Republican lawmakers said it would be a waste of time — and potentially bad for business. One of the first LGBT-related bills to get national attention, a bill in Indiana, sunk Gov. Mike Pence's approval rating and by some estimates cost Indianapolis $60 million in tourism and travel.

“We've just seen that states pay a price for being seen as anti-LGBT,” Oakley said. Social conservative lawmakers still introduce these bills, but the legislature as a whole — even extremely Republican ones — are “losing their appetite” to wage that battle, Oakley said.

Another theory is that President Trump is waging a big enough war on LGBT people for all the states combined.

From a ban on most transgender people serving in the military, to rescinding Obama-era guidance about letting schools open up bathrooms to transgender students, to battles over insurance coverage and housing rights, LGBT people — and especially transgender people — are fighting the Trump administration on nearly every front.

Social conservative lawmakers may not feel like it's that necessary to move related bills if the Trump administration is making sweeping national changes for them.

But it's also possible that the state battlefront is just changing, morphing from legislation to the ballot box. In November, LGBT advocates will likely face the first statewide ballot initiatives designed to repeal or weaken public discrimination protections. Those will be happening in Massachusetts and probably Montana. One of the last times LGBT advocates waged a similar high-profile battle, in Houston in 2015, they lost badly.

“The hardest fight is going to be the ballot fight,” said Chase Strangio, an attorney with the American Civil Liberties Union.

But there, too, LGBT advocates suddenly have reason to be optimistic. On Friday, LGBT advocates defeated an Anchorage ballot initiative to roll back protections for transgender people. It was the first time they've been able to defeat such a ballot measure.

Correction: The name of Equality Federation has been corrected.