Ascendant Republican presidential candidate Ted Cruz is running against New York City. Technically, he’s running against Donald Trump, who is currently in first place to Cruz’s second in the GOP primary race. But Cruz has turned the nation’s most populous city into a stand-in for the nation’s most popular blowhard, which gives him a chance to serve up a little subtle bigotry too.

Asked during Thursday night’s Republican debate in South Carolina about his previous attacks on Trump’s “New York values,” Cruz doubled down. “Everyone understands that the values in New York City are socially liberal or pro-abortion or pro–gay marriage, focus around money and the media,” he said.

Cruz is challenging Trump for the polling lead in Iowa and South Carolina, two states where Republicans are intensely socially conservative. Cruz is seeking to appeal to their anti-cosmopolitanism. Biographically, Cruz is not the best fit for that role: a Cuban-American who was born in Canada, he went to Princeton (an hour from New York City) and Harvard Law School (just outside Boston). Cruz’s wife works for Goldman Sachs, and he panders to socially liberal Wall Streeters when privately raising money from them.

Still, Cruz figures he can gain traction by attacking his opponent for being from a place that Bible Belt residents may regard as foreign, which proved to be a successful tactic for the even wealthier, more East Coast elite–pedigreed George W. Bush against “Massachusetts liberal” John Kerry.

Grist thanks its sponsors. Become one.

This could work in the Republican primaries, but it will not work in the general election. Unfortunately for Cruz, and his party, America’s relationship with urbanism is rapidly improving. Hating on cities just doesn’t pack the political punch it did two or three decades ago.

From the 1960s to the early 1990s, American cities experienced population loss, misguided urban renewal and highway construction projects, and rising crime rates.

Grist thanks its sponsors. Become one.

Not anymore. Most large cities are gaining population and seeing surging home values and declining crime. Americans are migrating to metropolitan regions, including to the inner cities at their cores. People are following jobs and they want shorter commutes. Some of them don’t want to drive at all. Millennials are ditching their cars. After many decades of steady growth, per capita vehicle miles traveled have gone down every year since 2005. Transit ridership is up. Americans are increasingly likely to say they would prefer to live in a walkable urban environment than a sprawling low-density one. And while that preference is heavily concentrated among liberals, it’s verging on a majority. Cities, even Cruz’s sprawling hometown of Houston, are responding to these changing preferences by getting denser and building transit, which is helping them lead the way in fighting climate change.

Even after sleeping on it, Cruz didn’t think better of picking a fight with a city that has the feistiest attitude and sharpest-elbowed tabloids this side of the Atlantic. At a South Carolina campaign stop on Friday, Cruz was asked about the calls on him to apologize from New York’s elected officials. He gleefully delivered a sarcastic faux-apology:

I apologize to the millions of New Yorkers that have been held down by liberal policies in New York City.

I apologize to the hard-working men and women in the state of New York who have been denied jobs because Gov. Cuomo won’t allow fracking. Even though there have been many high-paying jobs just south in Pennsylvania, New Yorkers have been denied the chance to provide for their families.

I apologize to all the pro-life, pro-marriage, pro–Second Amendment New Yorkers told by Gov. Cuomo that they have no place in New York, because that’s not who New Yorkers are.

I apologize to all the small businesses that have been driven out of New York City by crushing taxes and regulations. …

And I apologize to all of the cops, firefighters, and 9/11 heroes who had no choice but to stand and turn their backs on Mayor De Blasio, because Mayor De Blasio, over and over again, stands with the looters and criminals rather than the brave men and women of law enforcement.

These statements are misleading or outright false. Firefighters never turned their backs on de Blasio and the mayor never sided with “looters” or criminals over law enforcement. (The back-turning event involved some police officers, not firefighters; it was precipitated by de Blasio’s acknowledgement that, as the father of a black teenage son, he worries about police brutality.) If a state government legalizes gay marriage or makes abortion accessible, it is not telling people who oppose those civil rights that they are not welcome to live there. But if a state passes anti-gay laws and abortion restrictions, as Cruz’s state of Texas has, it really is telling some people they aren’t welcome. As for crushing the economy and job growth through taxes, regulations, and banning fracking, New York state’s median income is 16th among the states, higher than that of frack-happy Pennsylvania and Texas. The most affluent parts of the second- and third-richest states in the country, Connecticut and New Jersey, are suburbs of New York City.

So Cruz’s depiction of New York City as a failed experiment of big-city liberalism, economically stagnant and rife with rioting and crime, is extremely outdated. While there are older industrial cities that are still shrinking, it is precisely the famously liberal cities like New York, Los Angeles, San Francisco, Washington, D.C., Seattle, and Boston that are attracting growing waves of tourists, immigrants, and rich new residents.

Of course, the Republican primary voters in Iowa and South Carolina are not the most forward-thinking people. They skew white, old, rural, uneducated, and very conservative. These are the voters who have in recent years given Rick Santorum, Newt Gingrich, and Mike Huckabee upset caucus and primary victories. Cruz may have success appealing to their prejudices with anti-urban demagoguery. (Far-right, anti-immigrant Iowa Rep. Steve King, who is backing Cruz, uses “urban” as a codeword for black, even when he’s talking about black farmers, while South Carolina is, still, one of the most stubbornly segregationist states in the country.)

The Washington Post’s Paul Waldman explained this well on Monday. He writes:

Many [Republicans] look at New York and see someplace they can’t relate to, not just because it’s run by liberals, but also because it’s the epicenter of urban America, a place of noise and youth and rapid change. It’s a city of immigrants and a city of minorities — more than a third of the city’s population is foreign-born, and two-thirds are non-white. “New York is like a piece of the United States that’s not exactly traditional, it’s such a mixture of all kinds of feelings, all kind of backgrounds,” one Republican voter attending a tea party convention this weekend told BuzzFeed’s Rosie Gray. “I think it’s almost too much diversity.” Those feelings are the target for Cruz’s appeal.

The problem for the GOP in the general election, and in years ahead, is that the future of the country looks a lot more like the New York region than like rural Iowa or South Carolina. Anti-urbanism, like anti-science, anti-immigrant, and other backward attitudes, is a bad look for the GOP in the educated swing suburbs outside Denver, the North Carolina Research Triangle, and the D.C. suburbs in Northern Virginia.

Even some pro-Cruz conservatives see the risks in Cruz’s anti-urban strategy. National Review’s Kevin Williamson writes, “A great deal of wonderful, fruitful, productive, creative things happen in America’s cities. Being the party that urinates on them from a great height is not terribly bright.”