In 2004, Republicans viewed the specter of gay marriage as a political gift from the gods.

One year earlier, the Massachusetts Supreme Court had struck down state laws that limited marriage to opposite-sex couples. In February 2004, San Francisco Mayor Gavin Newsom (now California’s lieutenant governor) authorized marriages of same-sex couples inside the city limits, though courts soon put a stop to that.

To Republican strategists generally, and to Karl Rove, chief strategist for President George W. Bush’s re-election campaign, in particular, the very thought of gay marriage wending its way from such Gomorrah-like settings as Cambridge, Massachusetts, and San Francisco to a church near you provided a path not just to boost evangelical turnout in November’s election, but also to convince that great silent majority, on whom Republican candidates relied, that Democrats and liberals threatened the moral fabric of the nation.

In swing states like Ohio, fear of same-sex marriage, which Rove had made sure to stoke, was a major reason why Bush prevailed over Democratic presidential nominee John Kerry.

But that was oh, so then.

If it wasn’t obvious before, it’s become hi-definition clear in the past few weeks that the culture wars, long a powerful wedge that Republicans wielded against the Democrats, have now become a dagger that cleaves GOP ranks down the middle.

In one GOP-controlled state after another, legislatures have enacted measures that enabled businesses to discriminate against same-sex marriage partners or against gays and lesbians generally, only to face ferocious opposition from that pillar of Republican rectitude, American business. In many cases, opposition is so fierce it has led a number of Republican governors to veto the measures.

In Georgia last month, Republican Governor Nathan Deal vetoed a bill that would have allowed businesses to refuse to provide services to soon-to-be newlyweds if they were of the same sex, after coming under pressure from the state’s business establishment — including such iconic Georgia institutions as Coca-Cola. Republican governors have vetoed similar legislation in Arizona, Indiana and Arkansas (where Wal-Mart’s opposition clearly made a difference).

In North Carolina, however, similar legislation zipped through the legislature and received the signature of Governor Pat McCrory in just 48 hours, which gave businesses no time to mount an opposition. After the fact, more than 120 major corporations, including the Bank of America, the state’s largest employer, voiced their displeasure. PayPal, which had just announced an expansion in the state, cancelled it on Tuesday — and the 400 new jobs it would have created.

The wedge of the culture wars still cuts deep, but for Republicans, it’s been turned inward. Moreover, Donald Trump has risen to the top of this year’s GOP presidential candidate heap without placing any emphasis on the kind of culture-war issues that excite evangelicals. His recent floundering on abortion makes clear he’s barely given the issue any thought.

How did the Republicans get into this fix? In the first and most fundamental instance, there’s been a major shift in public opinion away from many of the phobias and bigotries on which Republicans have long relied. In particular, the dog-whistle and sometimes overt homophobia, xenophobia, racism and sexism, which have evolved as the American right’s electoral staples, are far less prevalent among the young. Which goes a long way to explaining the party’s dwindling numbers among voters under 40. The rising number of secular Americans (a 2015 Pew Foundation survey found that 23 percent of Americans and 35 percent of millennials were unaffiliated with any denomination) further underscores the growing marginality of right-wing evangelicals.

The rise of a tolerant mass market, in turn, has convinced the corporate sector that it’s bad business to back a number of discriminatory practices. (When it’s good business to back discriminatory practices — such as systemically underpaying women — that’s something else again.) Moreover, as gays and lesbians have felt it safer to come out of the closet during the past several decades, even business leaders have discovered friends, relations and co-workers who were gay — if indeed, like Apple’s chief executive officer Tim Cook, they weren’t gay themselves. For all these reasons, corporate America has become unprecedentedly vocal in opposing the evangelical war on gays.

Nor is the Republican universe limited to the increasingly warring factions of business and evangelicals. Trump has brought into Republican ranks a new third camp — secular working-class whites, many of them apparently open to racist and xenophobic appeals but largely unconcerned with the sex-centered issues that so vex the evangelicals, who have flocked instead to Senator Ted Cruz’s banner.

The extraordinary 2016 presidential election process has already revealed the massive disenchantment of working-class Republicans with what the party establishment has long viewed as Ronald Reagan’s holy writ: tax cuts for the rich, scaling back entitlements, overseas interventions and free trade. Now, the GOP’s evangelical base has run smack dab up against the party’s financial base — corporate America.

Beset by both a class war and a fierce culture war, Republicans are reeling. No longer merely a party in search of electable candidates, they have become a party in search of an identity.