A last-minute legislative deal to rewrite key sections of a voter-approved animal welfare law landed on Gov. Charlie Baker's desk on Monday, less than two weeks before the scheduled start of new regulations that could impact the availability of eggs and pork in Massachusetts.

After House and Senate negotiators announced a deal on Sunday night, the branches on Monday quickly agreed to a bill ( S 2603) updating the standards for housing egg-laying hens and delaying by seven and a half months the start of a ban on the sale of pork products from cruelly confined animals.

The bill overhauls a law voters passed via ballot question in 2016 just weeks before enforcement is set to begin, drawing fierce criticism from the Humane Farming Association, whose executive director accused other animal rights groups who support the measure of being "co-opted" by business interests.

Lawmakers said they believe the bill will help stave off shortages in available eggs and pork products that could stem from the new law, even as senators drew a line in the sand on enforcing cruelty standards to protect pigs.

"The outcome without this bill for Massachusetts has been crystal clear the whole time: no eggs, or ridiculously high-cost eggs," said Sen. Becca Rausch, a Needham Democrat who co-chairs the Environment, Natural Resources and Agriculture Committee and was one of three senators who crafted the compromise with the House. "Today, we are solving a real problem about chickens and eggs, and we did so through an open, accessible and transparent process without thwarting the will of the voters."

Rep. Carolyn Dykema, the lead House negotiator on the six-member conference committee that produced the accord after closed negotiations, said failure to implement changes would have created "potentially dramatic impacts to the availability of essential foods."

"Egg producers have told us that egg prices could skyrocket," Dykema said in a statement. "Local companies were being told that only 10% of their pork needs would be met, and available products would likely carry premium price tags. And further food supply disruptions would disproportionately burden those least able to withstand those burdens."

The legislation also shifts much of the regulatory responsibility from the attorney general's office to the state Department of Agricultural Resources. Healey's office would retain its existing enforcement authority.

The state agriculture department has been led since 2015 by Commissioner John Lebeaux. A certified horticulturist, Lebeaux's official biography describes him as "grandson of a farmer and son of a nursery owner" who previously served as president of the Massachusetts Nursery and Landscape Association.

In 2016, voters approved a ballot question implementing new standards on the treatment of farm animals and products they produce.

The law, which takes effect Jan. 1, 2022, prohibits all farm owners in Massachusetts from confining any animal cruelly. It also bans the sale of shell eggs and pork and veal meat from animals held in violation of those standards, including products manufactured in other states.

As originally approved by voters, the law defined cruel confinement as any enclosure that prevents "lying down, standing up, fully extending the animal's limbs, or turning around freely." For egg-laying hens, that meant each bird must be able to spread both wings without touching the side of an enclosure and have access to at least 1.5 square feet of "usable floor space" per hen.

Industry representatives and some animal rights groups say that in the five years since the ballot question sailed to victory with more than 77 percent of the vote, practices on the ground have shifted substantially. Many egg manufacturers now use aviary systems, which allow hens to access more vertical space, with a standard of one square foot of floor space per animal.

Under the compromise legislation, farmers could house hens with a single square foot of floor space per bird if they are placed in "multi-tiered aviaries, partially-slatted cage-free housing systems or any other cage-free housing system that provides hens with unfettered access to vertical space." Single-level enclosures would still need to offer 1.5 square feet per hen.

"The bill requires enrichments to be included in these vertical aviaries that allow hens to exhibit natural behaviors, including things such as perches, scratch areas, nest boxes and dust-bathing areas," said Sen. Jason Lewis, the lead Senate negotiator on the bill. "In other words, this standard is considered as humane or even more humane than the standard included in the 2016 ballot question."

Over the past seven months, a coalition of one-time ballot question opponents including the New England Brown Egg Council and the Humane Society of the United States came together to press lawmakers for changes to the law, which they said would maintain protection for animals while reflecting widespread adoption of aviary systems on the production side.

In a joint statement, the Humane Society, Animal Legal Defense Fund, Animal Rescue League of Boston and Massachusetts Society for the Prevention of Cruelty to Animals praised the bill's success.

"With passage of S. 2603, the Massachusetts legislature strengthened the existing law, passed at the ballot as Question 3 in 2016, to now mandate cage-free housing with critical behavioral enrichments for the birds, such as nest boxes, perches, and dust-bathing and scratching areas," the groups said. "Importantly, the legislature also expanded application of Question 3's protections to hens raised for liquid eggs — a move that will protect at least two million more hens each year."

But support for the change is not unanimous among animal rights groups. Bradley Miller, executive director of the Humane Farming Association, called the legislation "a devastating setback to farm animal protection and a major betrayal of Massachusetts voters."

Miller said in an interview that aviary systems have been around for "decades" and that reducing the standard from 1.5 square feet per bird to one square foot per hen will allow larger manufacturers to confine more animals in tight quarters, even if the birds are able to climb up to higher platforms.

"The egg industry and a few co-opted animal groups falsely portray this cruel reduction in space down to a mere one square foot per hen as an enhancement to Question 3," he said, referring to the 2016 ballot question. "In reality, this is an outright repeal and replacement of Question 3's central and most important animal anti-cruelty provision."

Miller said he hopes Massachusetts residents urge Baker to veto the bill. The Humane Farming Association, which sued Attorney General Maura Healey in January over a delay in crafting regulations, is "actively exploring a subsequent ballot measure to clarify that these animals need more space and these cruel factory farming bills must be repealed," Miller added.

For pork products, the legislation does not include any major reforms or amended definitions and instead kicks the effective date for the ban voters approved seven and a half months down the road.

Businesses would be able to continue selling pork from pigs confined in a way voters deemed cruel until Aug. 15, 2022 under the bill, after which all pork products in the Bay State would need to come from humanely housed animals.

Neither the original legislation that wound its way through the committee process nor the Senate bill approved in June included any changes to the deadline for enforcing the ban on certain pork products. The House Ways and Means Committee added language delaying the start date from Jan. 1, 2022 to Jan. 1, 2023 before the full House approved its version in October.

Lewis, who on Monday called his House counterpart Dykema "a tough negotiator," said the trio of senators "very reluctantly agreed" to a seven-and-a-half month delay.

"I want the pork industry to know in no uncertain terms that there will be no further extensions for them in Massachusetts," the Winchester Democrat said while addressing the Senate remotely. "They must come into compliance with Massachusetts law, overwhelmingly approved by our voters back in 2016, if they wish to continue selling their products to our consumers."

Dykema, a Holliston Democrat, did not take as hard a stance on the Aug. 15 deadline as Lewis did, leaving room in her statement for lawmakers to return to the issue in the future.

"The extension to the implementation timeline for pork products included in the final bill and endorsed by all conferees was not considered lightly," she said. "There was a reason that the 2016 ballot question required a two-year transition between the promulgation of the regulations and the implementation date. Significant infrastructure upgrades are needed to comply with this new law, changes made even more difficult with materials and labor shortages due to COVID-19. With this bill, we will ensure a smooth transition to the new humane animal care standards that we all support."

"The House conferees fully stand behind the conference report," Dykema added. "Since future legislatures can't be bound by our actions, whatever future proposals may be made would be evaluated, as they always are, on the merits and with a full understanding of context and potential impacts."

Miller, who criticized the addition of a change to the deadline for products from cruelly confined pigs as "all done in the dark," said he expects industry interests to push for another delay as August approaches.

"This so-called compromise of delaying the enactment for seven and a half months — that's a farce," he said. "That will be changed once the Legislature comes back in session. You can count on the pork industry seeking to push that date back even further."

Baker has not indicated if he plans to sign the bill, but he urged lawmakers to reach consensus and send him a proposal quickly with the specter of supply upheaval looming.

Beacon Hill on several occasions has stepped in to change laws that voters endorsed at the ballot box. In 2016, the Legislature voted to delay implementation of several sections of the law legalizing recreational marijuana to consider changes to the measure voters backed.

One year after it became available, lawmakers suspended a tax deduction on charitable giving that voters approved in a 2000 ballot question. Democrat leaders since then have resisted calls from Baker to revive the measure.