A majority of American voters support the legalization of marijuana, with men and younger voters holding more tolerant public views about use of the drug, according to a Quinnipiac University poll released on Wednesday.

Voters in Colorado and Washington approved recreational use of marijuana last month, making them the first states in the country to do so even though use of the drug is still illegal under federal law.

"With the use of marijuana for medicinal purposes legal in about 20 states, and Washington and Colorado voting this November to legalize the drug for recreational use, American voters seem to have a more favorable opinion about this once-dreaded drug," Quinnipiac pollster Peter Brown said.

The public backs legalization by 51 percent to 44 percent, the poll found, but is divided on the issue by age and gender.

Men support legalization by 59 percent to 36 percent while women oppose it by 52 percent to 44 percent. Two-thirds of voters under the age of 29 support legalization, while a majority of voters over the age of 65 oppose it.

"It seems likely, however, that given the better than 2-1 majority among younger voters, legalization is just a matter of time," Brown said. It was the first time Quinnipiac had conducted a survey on marijuana use.

The Quinnipiac poll also found voters taking a more favorable view of same-sex marriage, supporting it by a narrow margin of 48 percent to 46 percent. In July 2008, voters in the poll were opposed to same-sex marriage by 55 percent to 36 percent.

"It seems pretty clear that attitudes toward same-sex marriage in American society are changing rapidly. While the country remains split on the issue, supporters have come pretty far in the last four years," Brown said.

Voters under the age of 29 support same-sex marriage by 63 percent to 35 percent, Brown said, so "once again we see it's just a matter of time."

The national survey of 1,949 voters was conducted between Nov. 28 and Dec. 3 and has a margin of error of 2.2 percentage points.