Gay marriage is increasingly accepted across the country.

More Americans support gay marriage (47 percent) than oppose it (43 percent), according to a recent Pew survey. In 2004, 60 percent of Americans opposed it in Pew data. Only 8 percent were strongly in favor. In 2004, a majority did not support gay marriage in any state; by 2010, a majority did in 17.

Yet 32 times since 1998, voters have gone to the polls and voted against gay marriage.* Thirty-eight states prohibit gay marriage in some fashion. Even in “blue” states like California, Oregon and Delaware, gay marriage bans stand. North Carolina’s Amendment One Tuesday night was just the latest in a long line of failures at the ballot box for proponents of gay marriage. (Support for bans is falling over time, according to HRC: in 2004 they passed on average 71 percent to 29 percent, but in 2008 the average was 57 percent to 43 percent.)

Gay marriage has had more success in courts and state legislatures. But still, only six states and the District of Columbia allow gay marriage.

View Photo Gallery: Voters head to the polls in Indiana, where six-term senator Richard Lugar lost the GOP primary, and North Carolina, where voters approved a constitutional ban on same-sex marriage.

What explains the discrepancy between the national movement toward legalization of gay marriage with the repeated failures of such measures at the ballot box? A lot of it comes down to timing.

North Carolina was the last state in the South to pass a constitutional amendment banning gay marriage; it likely would have come up earlier if Democrats had not held the state’s legislature for 140 years straight.

“It says nothing about the overall momentum and says nothing about the prospects for success in states where the conversation on gay marriage is further along,” said Evan Wolfson of Freedom to Marry about the Amendment One vote. “To change hearts and minds takes time and persuasion and visibility for gay families and those that care about them, and that conversation has a longer way to go in North Carolina than it does in many other states.”

Minnesota, another state that already bans gay marriage by law, is the only other state with a constitutional ban on the ballot this year.

“We are not seeing amendments heading to the ballot at the level we once did because marriage equality, and LGBT equality in general, is not the wedge issue it once was,” said Human Rights Campaign spokesman Paul Guequierre.

Turnout is also a factor. Older voters tend to vote in higher numbers, and there’s a stark age divide on gay marriage.

As Columbia Political Science professor Jeffrey Lax wrote in 2009: “If policy were set by state-by-state majorities of those 65 or older, none would allow same-sex marriage. If policy were set by those under 30, only 12 states would not allow-same-sex marriage.”

Primaries, like the one in North Carolina last night, are particularly low turnout affairs— giving opponents to gay marriage the edge.

Should gay marriage be legal? Discuss here.

* A ban in Arizona failed in 2006 but a narrower version passed in 2008.