RICHMOND, Va. — A highly-contested bill that would make it a crime to own an assault weapon in Virginia passed the House of Delegates on Tuesday by a slim margin.

House Bill 961 made it past the House with a vote of 51-48.

The bill expands the definition of an assault weapon and bans anyone from purchasing or selling certain semi-automatic firearms, including AR-15 style rifles. Large-capacity firearm magazines, silencers, and trigger activators would also be prohibited.

It also forbids anyone in certain Virginia localities from carrying a shotgun with a certain magazine capacity.

A House committee advanced the bill last week. 

RELATED: Virginia Democrats advance assault weapon ban

If this measure becomes a law, anyone in possession of a large-capacity firearm magazine or trigger activator has until January 1, 2021 to render them inoperable, surrender them to police, or just get them out of Virginia altogether.

Also if it becomes law, people who purchase or already own assault weapons before the law takes effect would not have to surrender or render their firearm inoperable.

The legislation now moves to the Senate, where moderate Democrats have indicated they are unlikely to support the measure. 

Heated debates over guns have dominated this year's legislative session, as Virginia has become ground zero in the nation's raging debate over gun control and mass shootings.

RELATED: Virginia House advances gun control measures

RELATED: Virginia Attorney General files suit with other states over release of 3D-printed gun files

RELATED: No 'definitive motive' | Virginia Beach mass shooting independent investigation results released

The Associated Press contributed to this story.