ST. PAUL, Minn. — The Minnesota Senate voted Monday to make gay marriage legal, putting the state on the brink of becoming the 12th to allow same-sex couples to marry. Gov. Mark Dayton immediately announced he would sign the legislation Tuesday. The Senate vote of 37-30 came four days after the House passed the bill on a 75-59 vote. When the tally was announced, a huge cheer erupted in the chamber and gallery.

Minnesota will become the first state in the Midwest to make gay marriage legal via a legislative vote. Iowa legalized same-sex marriage in 2009 through a court ruling. Under the legislation, gay couples will be able to get married starting Aug. 1.

It’s a rapid turnaround for gay-marriage supporters, who just six months ago had to organize a massive effort to defeat a constitutional amendment that would have banned gay marriage. The groups quickly turned their attention to legalizing gay marriage, and their efforts were aided by Democrats capturing full control of the state government in November.

Only one Republican, Branden Petersen, voted yes on Monday. Three Democrats, all from rural Minnesota, voted against the bill.

The owners of Boulder’s Sterling University Peaks apartments, who this summer were cited for illegally subdividing 92 bedrooms in the complex, have reached an agreement to settle the case for $410,000, the city announced Thursday.