California is set to ban smoking and vaping at its state parks and beaches starting in 2020, according to legislation signed by Democrat Gov. Gavin Newsom on Friday.

The recently-signed law also bans the disposal of cigarette butts and cigar waste at state parks and beaches. Those who violate the law are subject to a fine of up to $25, the Associated Press reported.

The law covers both e-cigarettes as well as traditional cigarettes, and will allow people to smoke in parking lots of beaches and state parks.

Film and television productions that film in state parks with proper permitting can still allow people to smoke on state property.

Democrat state lawmakers have tried for years to approve a smoking ban, with lawmakers passing such a bill several times only for it to be vetoed once it reached former Democrat Gov. Jerry Brown’s desk.

“Third time is not always a charm,” Brown wrote in his veto message. “My opinion on the matter has not changed. We have many rules telling us what we can’t do and these are wide open spaces.”

Brown and former Gov. Arnold Schwarzenegger, a Republican, vetoed a total of seven bills sent to them over the past decade on a smoking ban, saying the ban involved “excessive punishment.” Many Republicans in the legislature also voted against the measure.

Democratic state Sen. Steve Glazer, who sponsored the legislation, argued that the rule would benefit public health and limit pollution.

California already bans smoking at childcare centers, within 25 feet of farmer’s markets, on public transportation, and within government buildings.

The state has 280 state parks and roughly 340 miles of coastline.

The recently signed law does not come cheap. A legislative analysis predicted that it would cost California’s state parks system nearly $2 million to enforce the ban and place 5,000 signs at each of its state parks to ensure compliance with the law.