Though it once held our rights at arm’s length, Walmart is now making steady turns toward support for LGBT nondiscrimination. What's driving the change? And are other Fortune 500 companies following suit?

On June 12, the same day 49 people were gunned down inside Pulse nightclub in Orlando, a Walmart associate from Marietta, Georgia, tweeted: “Y’all see a gay club shooting as a horrible tragedy. I see it as someone doing community service.” Barely 24 hours later, Walmart confirmed that it had fired the employee and that the company doesn’t tolerate such behavior.

While it’s no surprise that given today’s corporate vigilance, a Fortune 500 company would terminate a rogue employee, the twist in this case is the company’s reputation. Walmart’s checkered history on LGBT rights and its silence in the midst of discrimination lawsuits make it an unlikely prosecutor of hate speech. After all, this is the same company that, in 2007, announced it would no longer support LGBT organizations, citing a corporate mandate to remain neutral on controversial issues.

Over the past 15 years, though, Walmart has made an imperfect but nonetheless remarkable turnaround on LGBT advocacy. You can chart the company’s progress in the Human Rights Campaign’s annual Corporate Equality Index, which measures companies’ LGBT inclusivity. In 2002, the first year of the CEI, Walmart scored 14 out of a possible 100; in 2008, it scored 40; this year, it scored 90.

Perhaps more dramatically, Walmart has also begun to speak out against anti-LGBT legislation, including a so-called conscience protection bill that was ultimately defeated in the company’s home state of Arkansas. The bill “does not reflect the values we proudly uphold,” Walmart said in a statement last March, presaging statements that other companies — among them Apple, Salesforce, Yelp, PayPal, Disney, and Angie’s List — would make about similar bills in Indiana, Georgia, Mississippi, and North Carolina.

Walmart’s transformation into an LGBT ally may be a curveball in the retailer’s conservative half-century history, but it parallels America’s new boardroom ethics. Most major companies are now deeply invested in talent acquisition and retention, diversity initiatives, and good PR in the age of hashtag activism. Still, the idea of a company fighting religious-freedom bills — especially bills that, on the surface, don’t threaten revenue — is fairly radical. Walmart is part of a wave of companies that use their considerable economic clout to force progressive change. And it’s the company that perhaps best embodies both the promise and the provocation of such interventions.

There’s no avoiding Walmart in Bentonville, Arkansas. Home to the company’s corporate headquarters since 1970, and home to the Walton family since the ’50s, this once sleepy backwater in the state’s northwest corner is now dominated by the retail behemoth. Walmart is the largest employer in town (it’s also the largest private employer in the world), and its omnipresence is palpable. Convoys of Walmart semis chuff in and out of the company’s distribution centers; Crystal Bridges, the lavish art museum founded by Sam Walton’s daughter, attracts half a million visitors per year; and more than 600 Walmart vendors operate offices around Bentonville. This quaint Ozark Mountains outpost of 40,000 people is today a commercial powerhouse.

“People hold Walmart in high regard in this state,” says Danielle Weatherby, an assistant professor at the University of Arkansas School of Law. “There’s a lot of respect and tradition attached to Walmart being in northwest Arkansas, and people watch closely what Walmart does.”

Weatherby understands better than most the outsize, sometimes contested influence Walmart wields in Arkansas. In 2014, Weatherby’s hometown of Fayetteville, about 30 miles south of Bentonville, passed the state’s first municipal nondiscrimination ordinance, which covered LGBT citizens. After pushback from the religious right and the city’s chamber of commerce, the ordinance was repealed in December 2014. Supporters agreed to soften some of the ordinance’s provisions — and add more religious exemptions. Voters finally ratified it last September.

“Walmart was supportive of the ordinance but didn’t really get involved in that discussion,” Weatherby says. When pressed for details about Walmart’s support, she declines to go on record, noting that the company didn’t take an “active and public” stance. (Walmart representatives did not respond to several requests to be interviewed for this story.)

This, in a nutshell, exemplifies Walmart’s chancy commitment to LGBT equality. The company is an ally, but an inconsistent one. In 2015, for example, LGBT advocates criticized Walmart for not immediately objecting to Arkansas Senate Bill 202, which prevents local governments from protecting the civil rights of LGBT people. The same day that the bill became law after Gov. Asa Hutchinson refused to veto it, Walmart released an eleventh-hour statement that SB 202 “sends the wrong message about Arkansas.” By then, the statement was purely symbolic.

(According to The Walmart 1%, a blog that exposes the company’s inner workings, the retailer has donated $30,000 to Hutchinson since 2006 and more than $450,000 to Republican candidates for state office since 2000.)

The company fared better when it spoke out against Arkansas House Bill 1228. That bill, which died in the state Senate Judiciary Committee last year, would have allowed discrimination against LGBT people on the grounds of conscience and religious freedom. Walmart also joined Apple, Nike, Salesforce, Angie’s List, and other companies in protesting a similar bill

in Indiana.

What’s notable isn’t if and when Walmart protests such anti-LGBT legislation, but what its protest suggests about corporate responsibility at large. In Arkansas, “customers overlook or turn a blind eye to Walmart’s position on LGBT issues because they value Walmart and its presence in the state,” Weatherby says. But beyond Arkansas, Walmart can’t claim such die-hard allegiance, and the company is under pressure — from consumers, employees, advocacy groups, and the media — to take a proactive stance on LGBT policies.

Bentonville is a Republican stronghold, while the rest of Arkansas skews socially conservative. If Walmart can oppose anti-LGBT measures there without suffering a backlash, it should be able to do the same nationally. “The world is watching Walmart,” Weatherby says. “[It] can set a trend. And [Walmart] wants to get it right.”

But getting it right means embodying the old credo of “actions speak louder than words,” and here, again, Walmart is an instructive case. Jess Levin, a spokeswoman for Making Change at Walmart, is skeptical that the top brass really are LGBT cheerleaders.

“I’ll give them credit for being more inclusive in their hiring, but then you have to look at how those workers are treated in stores,” Levin says. “Over the past couple of years, Walmart has had several discrimination cases involving LGBT people. It comes down to what Walmart says they’re doing and what actually happens in stores.”

The discrimination cases Levin alludes to have only reinforced Walmart’s conservative image. Last year, the company became embroiled in a class action alleging that it denied the spouses of gay employees health care benefits prior to 2014. In another lawsuit, also filed last year, a transgender employee in New Jersey claimed she was harassed by her manager and ultimately fired because of her gender identity. More recently, the company has remained silent about North Carolina’s controversial “bathroom bill,” which requires students at state schools to use the public restroom that reflects their birth gender. Rival chain Target, meanwhile, welcomes employees and customers to use whichever restroom matches their gender identities.

“Time and again, when [Walmart] has real opportunities to be a leader on these issues, it hasn’t taken that opportunity,” Levin says. “You can write a great, very inclusive LGBT policy, but what matters is that you’re actually enforcing it.”

In terms of adopting inclusive policies, at least, Walmart has made steady progress. The company added gays and lesbians to its nondiscrimination policy in 2003. The following year saw the launch of Walmart PRIDE, an internal resource group for LGBT associates. In 2005, Walmart broadened its definition of “immediate family” to include same-sex couples recognized under state law. And in 2011, it added gender identity to its list of protected categories for employees.

If there’s any doubt about the company’s culture shift, consider this grim nugget from a 2012 story in the Arkansas Times: “Ten years ago, when queried about bias at company headquarters, one lesbian said she kept a photo of a fake husband on her desk to dispel suspicions. A transsexual said she presented as male to hide her true identity. Another woman reported that after coming out, she was written up, then terminated for what she said was a minor infraction.”

The Walmart of today sponsors more than 30 Pride events across the country, donates to LGBT organizations such as SAGE and the LGBT Bar Association, and celebrates diversity and inclusion on its corporate blog. The Williams Institute estimates that 4% of the population identifies as LGBT, so among Walmart’s global workforce of 2.2 million associates, that’s an estimated 88,000 people. Despite Walmart’s stop-start embrace of LGBT equality, the company has developed its positions under closer scrutiny and amid more tension than most other Fortune 500 giants.

When asked why Walmart can’t seem to shake its right-leaning image no matter what advancements it makes on the LGBT front, Danielle Weatherby says, “Walmart is seen as a company that, historically, has not put its employees first.” One could cite, for example, well-publicized scrimmages over fair wages, equal pay, unions, and diversity among management. Even Walmart’s philanthropy can be toxic. As the Washington Blade reported in August, the LGBT Bar Association came under fire for accepting a $30,000 donation from the retailer. How, critics asked, could LGBT attorneys accept handouts from a company facing a class action for denying LGBT employees spousal health benefits?

Weatherby adds, “It’s definitely worth thinking about: How do you reprogram the image of the company?”

For Walmart and its Fortune 500 cohorts, image is as crucial as revenue. Deena Fidas, director of HRC’s Workplace Equality Program, says that over the past five years there has been a “groundswell” of companies looking to be “on the right side of history.” She notes that in 2008, fewer than five major companies publicly supported marriage equality during California’s Prop. 8 campaign. Two years later, Fidas says, more than 40 companies spoke up in favor of marriage equality in New York.

“When businesses take this stand, they tend to get a lot of media,” she says. “They’re seen as leaders — not only as leaders on LGBT equality, but, more broadly, the corporate leadership appeals to millennials.”

Indeed, per a 2016 survey from the Pew Research Center, 71% of millennials support marriage equality. Perhaps this partly explains why so many tech firms have been among the vanguard challenging anti-LGBT bills. Last year, Salesforce threatened to pull a $40 million investment — along with 800 jobs — from Indianapolis if the Indiana General Assembly and Gov. Mike Pence didn’t amend the state’s discriminatory Religious Freedom Restoration Act. According to Bloomberg, the company’s senior vice president of government affairs and public policy ping-ponged between San Francisco and Indianapolis to pressure lawmakers in Indiana to revise the law. Likewise, Angie’s List suspended plans to expand its Indianapolis campus until the state’s RFRA was reconsidered. (Angie’s List declined to be interviewed for this story; Salesforce was unable to comment by press time.)

That same narrative has snowballed across the country over the past year. In a 2015 public statement, Yelp CEO Jeremy Stoppelman said he couldn’t imagine that his company would “create, maintain, or expand a significant business presence in any state that encouraged discrimination.” Apple CEO Tim Cook, who is gay, tweeted last March that he and his company were “disappointed” in Indiana and Arkansas for championing anti-LGBT bills. Nike CEO Mark Parker called such bills “bad for our employees, bad for our consumers, bad for business, and bad for society as a whole.” These sentiments were reiterated by Subaru, Microsoft, Wells Fargo, Orbitz, American Airlines, Levi’s, Gap, Twitter, and many others from the corporate big leagues.

In one of the most adventurous responses to an anti-LGBT law, porn website xHamster temporarily blocked IP addresses from North Carolina to protest that state’s bathroom bill. “Anytime you do something like that, you are going to lose revenue,” says spokesman Mike Kulich, “but, for us, it was important to take a stand.” He adds that while the site lost traffic in North Carolina, it gained visitors from other states.

As to evaluating a company’s inclusivity, Fidas defends the HRC’s Corporate Equality Index as a “clear, objective measure of policies, benefits, and practices.” Pride at Work, a constituency group of the AFL-CIO that supports LGBT labor, has criticized HRC for giving Walmart an “inflated” score despite the company’s pending discrimination suits. Fidas considers these criticisms markers of progress. “What you’re seeing is a change of appetite,” she says. “Different groups are saying, ‘Hey, shouldn’t businesses be doing more?’ And we think that call is very good.”

Selisse Berry, founder and CEO of Out & Equal, has watched corporate America answer that call over the past 20 years. When her organization launched in 1996, its priority was encouraging employees to come out at work and broach domestic-partner benefits with HR. “We thought we were so close to having an employment nondiscrimination act that we just needed companies to make sure they had policies in place so that people felt comfortable being out,” Berry says. “Of course, all these many years later, we still don’t have a federal policy to protect the LGBT community.”

Walmart was one of the companies that solicited Out & Equal’s advice early on. (The retailer has also donated at least $60,000 to the organization.) Berry traveled to Bentonville in the early 2000s and kindled what she calls a “long relationship, a kind of step-by-step” with Walmart. Berry thinks that one of the key catalysts for a company to become more inclusive is simply knowing the names and faces of its LGBT employees. “It’s not a big ask then,” she says. “You’re supporting [someone] rather than a nebulous or unknown entity.”

Deena Fidas of HRC goes even further, arguing that these companies represent a bold new frontier in lawmaking. Supporting LGBT equality isn’t just about improving corporate culture but also about pushing the country forward — while still keeping the bottom line in mind. Fidas says the private sector offers lawmakers a potent framework in which to lobby for LGBT inclusion. For her, the story boils down to the most basic principle in business: What American companies have done, she says, is “uncouple the conversation around LGBT equality from religion and morality. This is about dollars and cents.”