Minnesota became the 12th state to allow same-sex marriage on Monday with a vote by the state Senate. It also is the first Midwest state to permit gay marriage without being ordered to by a court.

The measure passed 37 to 30 after the state House approved the measure on Thursday. Democratic Gov. Mark Dayton's office said he will sign the bill into law Tuesday and it will take effect on Aug. 1.

“These families deserve the same rights and recognitions that we do,” state Sen. John Marty, a Democrat, told a crowd of supporters, the New York Times reported. “It’s finally happening.”

The Legislature's votes represent a dramatic turnaround for Minnesota. Two years ago Republicans controlled both chambers, shutting down a proposal by the governor. Opponents feared the rights of religious groups who believe marriage should be between a man and a woman would be infringed.

Minnesota's move follows passage in Delaware and Rhode Island within just the last two weeks, and recent action in Maryland.

Though same-sex marriage is now enshrined in all of the Northeast, with the notable exceptions of Pennsylvania and New Jersey, most of the country has no such legislation or bans such unions outright. Iowa was the first Midwest state to pass a law after it was decided in a state Supreme Court decision. Illinois allows civil unions and approved a same-sex marriage bill in February, but it has not yet been voted on in the House.