Despite agreeing with key elements of the bill, Gov. Charlie Baker vetoed legislation Thursday that would codify the right to an abortion in state law and make the procedure in Massachusetts more accessible by expanding access for women after 24 weeks of pregnancy.

The bill known as the ROE Act would also lower the age of consent for an abortion to 16, which the Republican governor said he "cannot support."

The Christmas Eve action by the governor kicks the issue back to the Legislature, where Baker said he hopes Democrats will reconsider his compromise proposal. After rejecting his proposed amendments this week, leadership in both the House and Senate are more likely to seek to override the governor within the next two weeks and appear to have the votes, even if by just a narrow margin.

Baker vetoed the legislation, which was originally included in the annual state budget, on Thursday afternoon, two days after the Legislature returned the abortion measure unchanged to his desk.

In his letter to lawmakers, Baker said he "strongly" supports a woman's right to access reproductive health care, including the provision in the bill that would make abortions available after 24 weeks of pregnancy if the fetus would not survive after birth.

He also said he supports eliminating the 24-hour waiting period for an abortion and changes to the judicial bypass process to make abortions more accessible to minors who cannot obtain parental consent.

"However, I cannot support the sections of this proposal that expand the availability of later term abortions and permit minors age 16 and 17 to get an abortion without the consent of a parent or guardian," Baker wrote.

The Legislature's version of the bill would also permit abortions after 24 weeks "if it is necessary, in the best medical judgment of the physician, to preserve the patient's physical or mental health."

Baker proposed to change the qualifying condition for a later-term abortion to "if a continuation of the pregnancy will impose, in the best medical judgment of the physician, a substantial risk to" the patient's physical or mental health.

The House voted 107-50 on Tuesday to re-enact the abortion bill (H 5179), giving leadership in that branch a slim cushion of two votes to reach the two-thirds majority needed to override Baker. In the Senate, the margin was a more comfortable 32-8 to reject Baker's amendment.

Rep. Jay Livingstone, a Boston Democrat and co-sponsor of the original legislation, expressed confidence in his newsletter Thursday that the ROE Act would become law.

"If he vetos it we have enough votes to override that veto and therefore it would become law," he wrote.

The abortion measure picked up steam following the death of Supreme Court Justice Ruth Bader Ginsberg. Democratic leaders argued that the nomination by President Donald Trump and confirmation of Justice Amy Coney Barrett put the legal right to an abortion established by Roe v. Wade in jeopardy, and warranted state-level action.

In additional to clarifying the right to abortion in state law, Livingstone said the bill improves access "by treating 16 and 17 year old pregnant individuals as adults, allows abortion after 24 weeks if there is a 'lethal fetal anomaly', and updates the law to incorporate medical terminology instead of anti-choice phrases currently in the law."

A coalition of reproductive rights groups, including Planned Parenthood Advocacy Fund of Massachusetts, quickly called on the Legislature Thursday to override Baker's veto.

The ROE Act coalition released a statement describing Baker's veto as "callous and dangerous" to the health and well-being of women in Massachusetts.

"With this veto, the Governor has made plain that he has no problem imposing medically unnecessary barriers that delay and deny care, and forcing families to fly across the country to get compassionate care. Our abortion laws are broken, and with two recent actions against equitable abortion access, Governor Baker is upholding our broken system," the coalition said.

Conservative critics of the bill have blasted Democrats for seeking to expand abortion, with the chairman of the Massachusetts Republican Party Jim Lyons likening the bill's provisions to "infanticide" and other opponents questioning whether 16 is too young to make such a decision alone.

Billerica Republican Rep. Marc Lombardo tried unsuccessfully when the bill last came before the House to amend it to require physicians to use life-saving equipment "to preserve the life and health of a live birth baby and the patient."

That amendment was rejected, with Democrats arguing that it was unnecessary and meant to stigmatize women who might seek a later-term abortion.

The House and Senate are next in session on Monday.