New York officials have reached an agreement to legalize cannabis products for adult use and allow residents to maintain a limited number of marijuana plants in their homes, a source confirmed Wednesday.

A final bill could be voted on by state lawmakers as early as next week.

The three-way agreement between state lawmakers and Gov. Andrew Cuomo's office fulfills a push from criminal justice reform advocates to legalize marijuana in the state over the last several years following a full Democratic takeover of the state Legislature.

Lawmakers on Wednesday afternoon were finalizing the bill's language. 

The measure is also a significant victory for a growing cannabis industry in the country, which is expected to generate billions of dollars in economic activity in the coming years in New York alone.

Supporters of the marijuana legalization push, however, wanted to ensure the program would include benefits for communities disproportionately affected by harsher drug sentencing laws as well as limit the influence of major businesses seeking to enter the new sector of the economy.

The agreement reached by lawmakers includes stipulations that would encourage small businesses to be able to set up shop. The agreement also includes a social equity fund that is meant to divert some of the revenue generated by marijuana sales to job placement and after school programs.

State lawmakers had worked for three years to reach an agreement for marijuana legalization, following smaller states like New Jersey and Massachusetts that border New York. At issue for some lawmakers were concerns over traffic safety and impaired driving. Senate Majority Leader Andrea Stewart-Cousins indicated this week that had been a final roadblock to an agreement.

Law enforcement and parent organizations had opposed the measure over safety concerns as well as the potential for children to access it.