Virginia has officially legalized cannabis, but the new law has several conditions that could have residents facing criminal charges if they possess large amounts of marijuana.

According to the legislation, locals over the age of 21 can now legally grow cannabis or marijuana but can only possess one ounce or less.

Those caught possessing between one ounce to one pound could face a fine of up to $25 and a civil penalty. Anyone in possession of more than that amount could face felony charges.

Those who choose to grow cannabis in their homes cannot sell the plant to others. Instead, they would have to share or gift the marijuana to someone 21 and older.

If a person is caught selling marijuana, they can face a Class 2 misdemeanor for their first offense. However, the second offense would be considered a Class 1 misdemeanor and punishable by up to a year in jail.

Growing marijuana plants is also limited to four plants per household and must be kept from public view and labeled.

Under federal law, cannabis users are not allowed to own guns. According to the federal background check, applicants are asked if they “are an unlawful user” of marijuana or any other narcotics.

“The use or possession of marijuana remains unlawful under Federal law regardless of whether it has been legalized or decriminalized ... in the state where you reside,” the ATF form states.

Those who lie on the form could face up to 10 years in prison and be charged with a federal felony.

Meanwhile, the use of cannabis remains illegal for anyone under 21 years old. For now, the Cannabis Control Authority will work on regulating the cannabis industry, and entrepreneurs can look forward to opening marijuana businesses in 2024 when it becomes legal in the marketplace.

Cannabis is displayed at Essence Vegas Cannabis Dispensary before the midnight start of recreational marijuana sales in Las Vegas, Nevada, June 30, 2017. Getty Images