Arizona lawmakers have endorsed a key element of President Barack Obama’s health care law in a huge political victory for Republican Gov. Jan Brewer, after a lengthy fight over Medicaid expansion that divided the state’s Republican leadership.

The expansion that will extend health care to 300,000 more low-income Arizonans came after months of stalled negotiations, tense debates and political maneuvering as Brewer pushed the Medicaid proposal through a hostile Legislature.

She secured her victory Thursday after lawmakers passed Brewer’s $8.8 billion state budget that included the Medicaid expansion provided under a key provision of the Affordable Care Act. The Legislature’s Republican leadership called it “Chicago politics” and labeled Brewer a puppet master, but Brewer remained undeterred as she prepared to sign the measures into state law.

“The day has been a red-letter day for the people of Arizona,” Brewer told reporters after the budget votes Thursday. “It was a win, win, win all the way around.”

Brewer, an early critic of the Affordable Care Act, surprised the nation when she acknowledged the Medicaid expansion as the law of the land in her State of the State address in January. She noted that rejecting an expansion would mean Arizona taxpayers would subsidize care for those in other states while receiving no benefits themselves.

The expansion is expected to help reduce the amount of uncompensated care hospitals must absorb and help cut what Brewer called a hidden health care tax that people who buy insurance pay, through higher premiums, to cover others’ care.

After the Legislature secured her political win, Brewer softened her support for the health care law.

“Medicaid was here long before Obama health care. I have never liked Obama health care,” she told reporters after the vote. “It has nothing to do with Obama health care.”

The expansion is optional under last year’s Supreme Court decision upholding the health care law, and many Republican governors rejected it.

In all, 23 states plus Washington, D.C., are moving ahead with the expansion, while 15 states have turned it down. Another 12 states are still weighing options.

Nearly all the states refusing are led by Republicans. Several of the states accepting have Republican governors, but most are led by Democrats.

Washington will pick up the entire cost of the expansion for the first three years and 90 percent over the longer haul. It’s estimated that less than $100 billion in state spending could trigger nearly $1 trillion in federal dollars over a decade.

In Arizona, Republican leaders in the Legislature called the expansion a massive government overreach that would drive the federal government deeper into debt. They predicted the government promises of paying for the expansion would turn out to be false.

“This is the biggest mistake we’ve made in the Arizona Legislature this year and maybe ever,” said Republican Sen. Kelli Ward, of Lake Havasu City.

Republicans control the Legislature and all statewide elected offices in Arizona, but the Medicaid fight highlighted internal fractures between those who want smaller government and others who, like Brewer, who said broader health care access is good for the state.

“The bottom line here is greed,” said Sen. Al Melvin, a Tucson Republican who is running for governor and voted against the Medicaid expansion. “The people who want this know in their hearts that Obamacare is going to collapse under its own weight.”

A newly formed coalition of Democrats and moderate Republicans worked closely with Brewer to stand up to the conservative leaders who had blocked debate on the Medicaid expansion for six months. Lawmakers worked through the night Wednesday to get the plan through the House, and the Senate vote came hours later Thursday afternoon.

“I’ve never seen the case where a governor has rolled over her own party because she was throwing a temper tantrum,” said Republican Rep. Eddie Farnsworth, of Gilbert.

Senate President Andy Biggs said lawmakers had little information about what was in the budget before passing it.

“I am deeply and profoundly disappointed at the manner at which this came down,” he said.

Brewer dismissed the insults, predicting that all would be forgiven and Republican leaders would move forward together.

“Tomorrow they’ll probably say ‘I’m sorry’ or we will just forget it,” she said. “I just try to listen and let it go.”

It was a year of wins and losses for Arizona’s GOP.

The Legislature voted to adjourn its 2013 session early Friday morning after passing a slew of other bills, including an election overhaul that could make it more difficult for voters to obtain and return mail ballots. Biggs had to beg for extra votes to get the measure opposed by Democrats and voter outreach groups passed in the Senate.

Among the bills left on the floor was a proposal that would have prohibited abortion clinics from using Medicaid dollars to fund administrative costs and allowed for unannounced inspections, a top GOP priority.

Still, Brewer signed more than 100 bills advanced by conservative Republicans throughout the marathon session, including a measure that bars cities and counties from destroying guns turned over to police at community buyback events and instead requiring that they be resold. She also signed bills that will wildly increase campaign finance limits for state candidates and require unemployed workers to present documents showing they were fired before they can receive benefits.

Through it all, Brewer made it clear that the Medicaid expansion was her top priority. She held multiple rallies featuring low-income patients on the Arizona Capitol lawn and during the final month of the session, Brewer refused to sign any other bills until lawmakers passed a budget that included the health care expansion.

The Medicaid plan would cover people making between 100 percent and 138 percent of the federal poverty level and restore coverage to more than 100,000 childless adults who lost Medicaid coverage because of a state budget crunch. About 1.3 million Arizonans already are covered by the state’s plan.