Governor Martin O'Malley signed Maryland's same-sex marriage bill into law on Thursday, making the state the eighth in the nation to allow gay couples the right to marry.

“I’m prepared to sign it because I believe that the way forward among people of many different faiths is always in the direction of greater respect for the equal rights for all,” said O’Malley before the signing, the Washington Post reported.

More from GlobalPost: Maryland Senate approves same sex marriage bill, virtually assuring passage

Governor O'Malley publicly opposed gay marriage for most of his political career, but began to change his stance on the issue in the last year, introducing it as part of his legislative plan last month, the Post reported.

“I think good leaders, who are progressive leaders, always try to be a force for building consensus that moves us forward," O'Malley said. “For a long time, I though that consensus point was civil unions. I was mistaken, I misjudged, the public moved forward more quickly on this issue than I had thought we would as a people.”

Maryland's Senate President Thomas V. Mike Miller Jr. voted against same-sex marriage, even though the Senate passed the bill 25 to 22 last Thursday, the Post reported. The House approved the bill 72 to 67, Reuters reported.

“Am I on the wrong side of history? As a historian, there is no doubt about it. There is no doubt about it,” Miller said. “At the same time, I understand that, and I’ll deal with that in my own mind. ...I believe marriage is between a husband and wife and that’s the reason I [voted] the way I [did]."

Even before the signing on Thursday at 5 p.m., Maryland's opponents of same-sex marriage were working to repeal the law on the ballot in November, Reuters reported.

"The citizens of the state, since it's such a weighty issue, should have a final say," Republican Delegate Tony O'Donnell, the House minority leader who opposed the bill, said on Monday. "All polling data shows that the state is closely divided on this issue."

The push to repeal the bill is hardly unexpected; almost every state that has passed same-sex marriage has opponents pushing to get the bill on referendum ballots.

More from GlobalPost: Washington state governor Christine Gregoire signs gay marriage into law

Opponents would need nearly 56,000 signatures to get the measure on the ballot, according to the Maryland State Board of Elections. They would need to submit a third of those signatures by May 31 and the remainder by June 30 to get the measure on the November ballot.

"The governor has faith in the people of our state," Takirra Winfield, the governor's spokeswoman, said, adding that the governor believed voters will "seek to take the best action that will protect equality for all," Reuters reported.

Same-sex couples can marry in the District of Columbia and in the states of Massachusetts, Iowa, Vermont, New Hampshire, Connecticut and New York. Washington state will join the list in June unless opponents manage to repeal the state's same-sex marriage bill at the ballots.

The District of Colombia has more same-sex couples than any other state, according to a study of the 2010 US Census by the Williams Institute, with 18.08 same-sex couples per 1,000 households, the Kansas City Star reported. Vermont and Massachusetts, which both allow same-sex marriage, were second and third. Maryland ranked 19th, with 5.81 same-sex couples per 1,000 households, the Star reported.