(CNN) -- Fewer than half of Americans oppose legalized same-sex marriage, according to a new poll on the issue released Wednesday, with significant shifts in public opinion on the issue just since last year.
More Americans continue to oppose gay marriage than support it, according to the poll, which was released Wednesday by the Pew Research Center. But for the first time since Pew starting asking about same sex marriage 15 years ago, fewer than half of those polled said they oppose legalizing the institution.
The poll revealed other firsts. For the first time since Pew began asking about the issue, more white mainline Protestants and white Catholics favor gay marriage than oppose it.
"The shift in opinion on same-sex marriage has been broad-based, occurring across many demographic, political and religious groups," Pew's polling analysis said.
The analysis noted that political independents, who were opposed to gay marriage by a wide margin just last year, are now divided on the issue.
The poll -- which combines two surveys conducted from July to September of this year -- found that 42 percent of Americans favor same-sex marriage, while 48 percent oppose it.
In polls conducted in 2009, 37 percent favored gay marriage while 54 percent were opposed, Pew said.
"The public continues to be far more supportive of gays and lesbians serving openly in the military than of allowing legal same-sex marriages," the Pew's polling analysis notes.
Sixty percent of Americans favor allowing gays and lesbians to serve openly in the military, while 30 percent oppose it. Support for gays serving openly in the military has remained fairly stable over the last five years, Pew said.
On gay marriage, the new poll found significant differences of opinions along age, racial and partisan lines.
Americans in the so-called Millennial Generation -- those born after the 1980s -- favor gay marriage by 53 percent to 39 percent, the poll found. Among those born between 1928 and 1945, just 29 percent favor allowing gays and lesbians to marry legally, while 59 percent are opposed.
Among Democrats, 53 percent support legalized gay marriage, while just 24 percent of Republicans do.
And while whites are evenly divided over gay marriage, the poll found, blacks oppose legalizing the institution by a wide margin.