The Michigan Senate voted Tuesday to expand Medicaid under the Affordable Care Act, extending health coverage to more than 400,000 low-income residents, but not without a little legislative drama first.

The GOP-controlled chamber approved the bill by a 20-18 vote at about 8 p.m. Tuesday after being in session for more than eight hours, much of it spent in caucus debating how to get the expansion passed. Eight Republicans finally joined 12 Democrats to pass the bill.

The House, which had already passed an expansion bill, will soon take a concurring vote, and Gov. Rick Snyder’s office confirmed to TPM that the governor would sign the legislation when it reaches his desk.Before the bill ultimately passed, the legislation was stuck in parliamentarian limbo for more than two hours.

The bill needed 20 votes out of the 38-member Senate to pass. On its first vote at about 5:30 p.m., it received 19 yea votes and 18 nay votes in a floor vote, but Republican Sen. Patrick Colbeck, who is vehemently opposed to expansion, abstained from voting. If he had cast a nay vote, leaving a 19-19 tie, then Republican Lt. Gov. Brian Calley could have cast the tiebreaking vote to pass the bill, as Calley has pledged to do.

But because Colbeck didn’t vote, the bill failed when it didn’t reach the 20-vote threshold. The Senate then immediately voted 21-17 to reconsider the vote and went into recess so the party caucuses could meet. It took more than two hours before the Senate reconvened and finally passed the bill.

Sen. Tom Casperson, a Republican, switched his vote after securing an amendment that reformed hospital payments for uncompensated care for the uninsured. According to tweets from local reporters, Casperson had been expected to vote for the expansion initially, but unexpectedly voted nay on the first floor vote. His yea on the second floor vote made Calley’s tiebreaking vote unnecessary.

The Senate also rejected two alternative proposals that would have relied on state-only funding to expand health coverage.

Michigan joins a handful of other red states that have signed onto this key piece of Obamacare, which grants Medicaid eligibility to people with incomes up to 138 percent of the federal poverty level. Arizona and North Dakota are two other uniformly Republican states that agreed to the expansion; New Jersey Gov. Chris Christie also endorsed an expansion proposal from his Democratic-controlled state legislature.

As TPM reported last week, several key red states — of which Michigan was one — are still debating the Medicaid expansion. Proposals in Ohio and Virginia are very much alive and could be approved before Jan. 1, 2014, when the expansion goes into effect. There is a substantial impetus for those states to get expansion passed as soon as possible: the ACA requires the federal government to cover 100 percent of the costs from 2014 to 2016.

But because more than 20 Republican-controlled states rejected the expansion, made optional by the U.S. Supreme Court in its Obamacare ruling, up to three million fewer people are expected to be covered under the law, according to the Congressional Budget Office.

It wasn’t an easy path to passage in Michigan, despite Snyder’s enthusiastic endorsement. The Senate had rejected the House’s expansion bill earlier this summer, and Senate GOP leaders were forced to break their own version of the “Hastert Rule” — which usually requires a majority of the majority caucus to approve a bill for it to reach the chamber floor — to get the expansion passed.