SACRAMENTO, Calif. (AP) — California Gov. Jerry Brown is leaving office Jan. 7 after signing more than 1,000 laws in his last year, further positioning the state as a bastion of liberal activism and goad to President Donald Trump.

The laws, most of which take effect Tuesday, ease criminal sentences, tighten gun restrictions and address climate change, gender discrimination and sexual harassment.

The Democratic governor approved 1,016 laws, the most in any of his last eight years in office. His 201 vetoes also were the most during his final two terms, as lawmakers passed a record number of measures.

Counting his two terms from 1975 to 1983, the state’s longest-serving governor vetoed 1,829 bills and saw 17,851 become law.

Here are some of the laws taking effect with the new year:

CRIMINAL JUSTICE

Sweeping new laws bar juveniles younger than 16 from being tried as adults, even for murder, and keep children under 12 out of the criminal justice system unless they are charged with murder or rape.

Other laws allow many defendants to ask judges to dismiss their charges if they show mental illness played a major role in their crime and limit the state’s felony murder rule, which holds accomplices to the same standard as the person who carried out the killing.

A new law responding to police shootings of young black men broadens public access to officers’ personnel records. A police union is challenging whether the law is retroactive.

Repeat drunken drivers and first-time offenders involved in injury crashes must install an ignition interlock device, which blocks their vehicle from starting if the driver isn’t sober.

GUNS

Spurred by mass shootings, lawmakers further tightened California’s already tough gun laws.

Anyone convicted of certain domestic violence misdemeanors will be barred for life from possessing a firearm, while those under age 21 will be banned from purchasing a rifle or shotgun unless they are members of law enforcement or the military or have a hunting license.

Several other laws already took effect, including measures explicitly banning rapid-fire bump stocks that attach to guns; requiring eight hours of training for concealed carry applicants; and allowing police to seize ammunition and magazines under domestic violence restraining orders.

A lifetime firearm ban goes into effect in 2020 for anyone who has been hospitalized for a mental health issue more than once in a year.

WILDFIRES

Utilities may bill customers for future legal damages and for settlements from the deadly 2017 wildfires that caused more than $10 billion in insured losses, even if the companies’ mismanagement caused the blazes.

The measure is among more than two dozen wildfire-related laws.

Others make it easier to log trees, build firebreaks and conduct controlled burns of vegetation that would fuel wildfires; require investor-owned utilities to upgrade equipment so it’s less likely to cause fires; safeguard residents’ insurance coverage following disasters; and improve emergency notifications.

GENDER DISCRIMINATION AND SEXUAL HARASSMENT

California becomes the first state to require publicly held corporations to have at least one woman on their boards of directors by the end of 2019 and two or more by 2021.

Spurred by the #MeToo movement, another new law bans private and public employers, including the state Legislature, from reaching secret settlements over sexual assault, harassment or discrimination. A law preventing businesses from requiring employees to sign liability releases to keep their jobs or receive bonuses is among several expanded protections.

Californians also can list their gender as “nonbinary” on their driver’s licenses, designated as the letter “X.”

CLIMATE CHANGE

California’s utilities must generate 60 percent of their energy from wind, solar and other renewable sources by 2030, which is 10 percent higher than a previous mandate. Lawmakers set a goal of phasing out electricity from fossil fuels by 2045.

“This is historic because there is no economy larger in the world that has committed to pure clean energy,” former Democratic state Sen. Kevin de Leon of Los Angeles wrote when Brown signed the bill into law.

It was California’s latest ambitious reaction to Trump’s decisions to withdraw from the Paris climate accord and revive the coal industry.

Other new laws study ways to ease the impact of climate change, encourage the use of biomethane and protect Obama administration targets for removing “super pollutants” called hydrofluorocarbons from refrigerants.

Another law bars the Trump administration from expanding oil drilling off the California coast by blocking new pipelines and other supporting construction in state waters.

OTHER LAWS

— Dine-in restaurants may only provide drinking straws at customers’ request.

— Restaurants that advertise children’s meals must include water or unflavored milk as the default beverage, though customers can still order other options.

— Elections officials must provide prepaid return envelopes for vote-by-mail ballots. They also must give voters a chance to correct a ballot signature that doesn’t match the one on file and let them track mail-in ballots.

— The minimum wage rises to $12 for companies with 26 or more employees and $11 for smaller businesses as California phases in a $15 base hourly wage.

— A bill protecting net neutrality rules was set to take effect Jan. 1 but was blocked until a federal lawsuit is resolved.