Amid a cascade of cheers and applause, Gov. Mark Dayton legalized same-sex marriage in Minnesota on Tuesday surrounded by thousands of gay and lesbian supporters and advocates.

"By your political courage, you join that pantheon of exceptional leaders who did something extraordinary," Dayton said. "You changed the course of history for our state and our nation."

Dayton signed the marriage measure at a historic outdoor ceremony, a day after the Senate and House passed the proposal.

Minnesota will become the first Midwestern state to legalize same-sex marriage by legislative vote and the 12th state in the nation to recognize such unions. Dayton’s action technically repeals a state statute that had prohibited same-sex marriage.

The law will take effect Aug. 1.

Dayton acknowledged that a difficult step has been taken, but called it a crucial moment for equality.

“Progress has often been difficult, controversial and, initially, divisive,” Dayton said. “However, it has always been the next step ahead to fulfilling this country’s promise to every American.”

The ceremony kicked off a parade that took supporters to a massive downtown St. Paul celebration. The parade route in was lined with rainbow flags for the event.

While the rancor over same-sex marriage might have ended at the Capitol this year, the state remains bitterly divided over the issue.

Several churches and religious groups were holding private prayer vigils during the ceremony and throughout the week.

The Minnesota Family Council, which opposes same-sex marriage, was making last-ditch automated calls to supporters urging them to pressure Dayton to veto the measure.

Minneapolis Mayor R.T. Rybak is opening City Hall at 12:01 a.m. the day the law takes effect and will personally officiate wedding ceremonies for gay and lesbian couples.

