[What you need to know to start the day: Get New York Today in your inbox.]

TRENTON — A monthslong effort to legalize marijuana in New Jersey collapsed on Monday after Democrats were unable to muster enough support for the measure, derailing a central campaign pledge by Gov. Philip D. Murphy and leaving the future of the legalization movement in doubt.

The failure in the Legislature marks one of the biggest setbacks for Mr. Murphy, who, despite having full Democratic control in the State Senate and Assembly, has faced constant party infighting and has struggled to convince lawmakers of his progressive agenda.

Among the most vocal opponents were a handful of African-American Democratic lawmakers who split with their party over legalization, arguing that it would be a public health menace to their communities.

The abrupt unraveling of the campaign to legalize marijuana also reflected how some lawmakers were swayed by the challenges faced by other states that have legalized cannabis, including how to keep the drug away from teenagers and prevent people from driving under its influence.