Tobey and Ouellette, who met four years ago, tied the knot last September -- in a church.

"We are affiliated with the United Methodist Church, which on the whole does not support same-sex marriage," Tobey said. But their church made a hearty exception. "We had three pastors who know us and love us and agreed to do that for us."

The legal situation led the couple to do things in reverse order. After their wedding, they applied for a name change. Now that the referendum has passed, they'll apply for a marriage license.

Maine should begin granting marriage licenses to same-sex couples in mid-December, according to same-sex marriage supporters at Freedom to Marry.

What the measures say

The two measures that passed, called "Question 1" in Maine and "Question 6" in Maryland, contain similar language.

The words man and woman "relating to the marital relationship or familial relationships must be construed to be gender-neutral for all purposes," the Maine measure says.

Maryland's ballot reads, "Civil marriage laws allow gay and lesbian couples to obtain a civil marriage license."

Both measures also explicitly mention the right of clergy to refuse to wed gay and lesbian couples if it goes against their religious convictions.

"This chapter does not require any member of the clergy to perform or any church, religious denomination or other religious institution to host any marriage in violation of the religious beliefs of that member of the clergy, church, religious denomination or other religious institution," Maine's Question 1 states.

The governments of Maine and Maryland had passed laws permitting same-sex marriage, but activists opposed to the laws collected enough signatures to put them on a ballot, said Fred Sainz, a spokesman for Human Rights Campaign, which raised $32 million for its campaigns on the referendums that included radio and television ads, social media strategy and on-the-ground canvassing by thousands of volunteers.

Opponents of same-sex marriage say the new laws in both states will redefine marriage for everyone as a genderless union and endanger the fabric of society.

"Such a radical change in the definition of marriage will produce a host of societal conflicts that government -- exercising its enormous enforcement powers -- will have to resolve," argues Maryland Marriage Alliance.

The group also published an online opinion by parents stating that legalizing same-sex marriage would lead to the promotion of homosexuality in school curriculum.

Sainz believes the campaigns supporting the Maine measure paid off.

In 2009, a similar referendum in Maine failed when voters rejected the governor's decision to allow same-sex marriage. Tuesday's results represent a remarkable turnaround.

"The secret to our success is that we won over hearts and minds," Sainz said. "Americans are fair and want to see their gay and lesbian friends, co-workers and family members have the freedom to marry."

Thirty-eight states have passed bans on marriages between people of the same gender, mostly by amending their constitutions to define marriage as a union between a man and a woman.

In the six states -- Massachusetts, Connecticut, Iowa, Vermont, New Hampshire and New York -- and the District of Columbia where gays and lesbians have previously won marriage rights, it was because of actions taken by judges or legislators, not voters.

On election night, Tobey joined friends as they all watched results on TV.