Gay marriage celebrates its 8th anniversary in Massachusetts on Thursday.

It was on May 17, 2004 that celebrations erupted in town halls across Massachusetts as the first gay and lesbian couples legally exchanged vows after the state Supreme Court ruled a gay marriage ban unconstitutional. The scenes were cheerful as hundreds of well wishers rushed to witness history unfold before their eyes.

According to the group MassEquality, 18,462 gay couples have wed in the state since 2004.

The anniversary comes as President Barack Obama earlier this month declared his support for gay marriage.

In Provincetown, the gay Mecca of New England, the legalization of gay marriage has created a booming gay wedding cottage industry.

But there have been rocky moments along the way. Years of hand wringing followed the court's decision as gay marriage foes fought to amend the state Constitution to re-ban gay marriage. In 2007, lawmakers decided to abandon the effort as support for the institution grew.

The next year, lawmakers paved over an obscure 1913 law that banned non-residents from marrying in the state if the marriage was not recognized in their home state.

Arline Isaacson, co-chair of the Massachusetts Gay & Lesbian Political Caucus and an architect of gay marriage in Massachusetts, said supporters won marriage equality by outflanking opponents.

“In order to win the right for gay people to marry it takes a number of variables that include working very, very hard but as importantly, working smart,” Isaacson said on the gay rights website “It means trying to think like the enemy. Trying to think like our opponents.”

“That's one of the things we did so well in Massachusetts and it made all the difference in the world. We quite literally in Massachusetts out-lobbied our opponents, out-maneuvered our opponents, out-parliamentary procedured our opponents and out-organized our opponents every step of the way.”

In addition to Massachusetts, seven states – New York, Washington, Maryland, Connecticut, Vermont, New Hampshire and Iowa – and the District of Columbia have legalized gay marriage. Laws in Maryland and Washington have yet to take effect and opponents have vowed to repeal them. Several states, including California, New Jersey, Rhode Island, Hawaii, Illinois, Oregon and Delaware, grant gay and lesbian couples nearly all the legal protections of marriage through civil unions or domestic partnerships.