Arizona’s governor signed into law on Friday a bitterly contested proposal that will restore a federal health insurance program for children from low-income families, making it the last of its 49 counterparts to join the program.

Arizona opted out of the federal Children’s Health Insurance Program in 2010 over cost concerns as it grappled with a budget crunch.

The program aims to help working families who earn too much to qualify for Medicaid health care coverage for the poor, but who cannot afford private health insurance.

To qualify for KidsCare, as it’s known in Arizona, a family of four must earn between $33,000 and $49,000 annually. It is estimated to serve about 30,000 children in Arizona.

Arizona’s Republican governor, Doug Ducey, signed the legislation over fierce objections from the top two lawmakers in his own party a matter of hours after it cleared the Republican-led legislature.

The debate over the program was among the most rancorous of the legislative session and focused on both costs and the fact that the measure was tacked on to a virtually unrelated school voucher bill, prompting concerns that the law would face a legal challenge.

Backers said the program is desperately needed to close a gap in affordable health insurance options and to ensure that children are able to grow up healthy.

Even though the state is no longer required under the program to contribute funds in exchange for federal dollars, as was the case in 2010, opponents argued that Arizona citizens are still indirectly financing the program by paying for the program through federal taxes.

Arizona’s House of Representatives approved the measure on Thursday following heated debate.

The law could take effect as early as August.

(Reporting by David Schwartz in Phoenix, Arizona; Editing by Eric M. Johnson in Seattle)