A bare majority of voters in Florida and Ohio, and nearly half in Virginia, support the right of same-sex couples to wed, according to September Washington Post polls showing that the national trend toward accepting such unions has taken hold in these swing states.

The growing support is a sharp departure from eight years ago, when opposition to gay marriage was so widespread that it may have helped tip the scales in favor of President George W. Bush’s reelection. Today, the politics of the issue is murkier.

In Florida, 54 percent of voters think same-sex marriage should be legal, while 33 percent say it should be illegal. In Ohio, 52 percent say it should be legal, while 37 percent say it should be illegal.

In 2004, by contrast, nearly two-thirds of Ohio voters — 62 percent — supported a constitutional amendment defining marriage as “only a union between one man and one woman.” The Ohio ballot initiative may have driven more voters to the polls who then supported Bush, according to exit surveys.

In 2006, 57 percent of Virginia voters supported similar legislation. And in 2008, among Florida voters, 62 percent supported an amendment limiting same-sex marriage in their state.

How states recognize same-sex marriage.

This year, the issue has hardly registered in the presidential campaign, even though President Obama announced in May that he was in favor of same-sex marriage. Republican challenger Mitt Romney has said he opposes such unions and supports a federal constitutional amendment banning them.

Despite the growing acceptance of same-sex marriage, it still has been a loser at the ballot box, at least through 2010. Six states and the District have legalized such unions through court or legislative action, but dozens more have banned them after the issue was put to a referendum.

Gay rights activists in Maryland, Maine and Washington state hope to break that trend in next month’s election, when voters will be asked whether they want to legalize same-sex nuptials in their states. In Minnesota, voters will be asked if they want to ban gay marriage.

Danny Martin, 54, a former factory worker from Columbus, Ohio, reflected the shifting public attitudes, saying he has had a gradual change of heart on the issue.

“When I was growing up, it was like, you don’t talk about that stuff,” said Martin, a respondent in The Post’s Ohio poll. “Now, we’re more open about it. And I have some friends who are gay, and they don’t come off to me as anybody different than any other people.”

In Virginia, the nine-point gap between those who support and oppose same-sex marriage — 49 percent in favor and 40 percent opposed — represents a significant gain in support compared with a Post poll in May, when 46 thought it should be legal and 43 percent said it should be illegal.

Partisan reactions are consistent across the swing states; about two-thirds of Democrats support legal same-sex marriage compared with a third or fewer of Republicans. In Florida and Ohio, close to six in 10 independents support such unions, while in Virginia the figure is a bit lower at 54 percent.

Age is an important factor: About two-thirds or more of those younger than 40 support legalizing gay marriage in each state. Among voters ages 40 to 49, the figure in Florida is 58 percent, but that dips to under half in Ohio and Virginia. Those ages 50 to 64 appear more divided, with a majority of seniors in Ohio and Virginia opposed to gay marriage.

Erin Eastabrooks contributed to this report.