Government-funded health care will be accessible for more than 14,000 children in Oregon who were brought to the United States illegally, under a bill the Legislature passed on Friday and that has been championed by the governor.

Debate over the measure, which passed the House 37-23 on the last day of the 2017 legislative session, was testy at times. It culminated a wave of legislation aimed at protecting immigrants against a federal crackdown by the Trump administration, which is stepping up deportations and vows to build a wall along the Mexican border.

The cost of extending health care for an estimated additional 14,174 children during an 18 month-period starting on Jan. 1, 2018, when the bill takes effect, will be $36.1 million, according to the state Department of Administrative Services.

Rep. Teresa Alonso Leon, a Democrat who herself was brought illegally to the U.S. from Mexico as a child and later gained U.S. citizenship, said the “Cover All Kids” bill is a priority for families in her district, centered around the primarily Latino town of Woodburn between Portland and Salem.

“For so many families in my district, when a child is sick or has a medical emergency, it can be one of the most painful things a parent can face,” Alonso Leon said on the floor of the House before the vote. “That is because it often means choosing between getting their children the care they need, or putting food on the table, or paying rent for that month. I believe that no Oregon family should even have to make these choices.”

Rep. Julie Parrish, a Republican from the Portland suburb of West Linn, opposed the bill, asking how much more of a financial burden Oregonians can bear.

House Republican Leader Mike McLane, of Powell Butte in Central Oregon’s high desert, stood up and complained after a fellow lawmaker said passing the bill was the right thing to do.

“That impugns the motives of a contrary vote,” McLane said.

House Speaker Tina Kotek dismissed the complaint, telling McLane it’s a common phrase that’s not meant to impugn anyone.

Another Republican, Rep. Duane Stark of the foothills town of Grants Pass, then took up the issue.

“The right thing to do is to take care of our citizens,” Stark said. “The right thing to do is to not jeopardize our federal funding. The right thing to do is to not extend our health care system when we’ve been struggling to pay our current obligations. The right thing to do is to vote no.”

Gov. Kate Brown responded on Twitter after the yes vote, saying “I’m proud the House helped fulfill our duty to ensure all Oregon’s children have access to health care by passing #CoverAllKids today.”

Another bill, introduced at the request of Brown and Attorney General Ellen Rosenblum, who are both Democrats, strengthens Oregon’s unique sanctuary-state status. It awaits Brown’s signature after the Senate passed it 16-13 on Thursday, with only Republicans voting against. The House earlier passed the bill that bars state and local agencies from asking about a person’s immigration status, and from disclosing information to federal officials.

Oregon became America’s first sanctuary state in 1987 with a law preventing law enforcement from detaining people who are in the United States illegally but have not broken other laws. In February, Brown ordered all state agencies to follow it.

President Donald Trump wants to cut funding to sanctuary cities that refuse to cooperate with federal immigration agents.

In another move aimed in part at extending services to immigrants, the Legislature on Wednesday passed a reproductive health-care bill, focused on abortions. It requires insurance companies to cover abortions at no cost to the patient, and stipulates that people who have no insurance, including those in the country illegally, can have those costs paid by the state’s Medicaid program.