The state house in Annapolis. (Mark Gail/The Washington Post)

Maryland on Sunday will become the third U.S. state to permanently ban hydraulic fracturing, ending several years of debate over whether to allow the gas-extraction method.

Passage of the fracking ban was one of the surprises of the 2017 legislative session in Annapolis, coming after Gov. Larry Hogan (R) announced that he had changed his position on the bill and would support it.

It is one of several high-profile laws that take effect in Maryland on Oct. 1.

The measures include: a law on price gouging that gives the state attorney general the authority to sue drug companies that dramatically increase the price of off-patent or generic drugs; a law that increases by 13 years the amount of time that a person who alleges child sexual abuse has to file a lawsuit, lifting the age cap from 25 to age 38; ethics reform pushed by Hogan in an attempt to address a string of scandals involving Democratic lawmakers; criminal-justice reform aimed at reducing recidivism and state prison costs; and making it easier to expunge minor offenses from residents’ driving records.

The law on price gouging, the first of its kind in the country, is being challenged in federal court by a generic-drug trade group called the Association for Accessible Medicines. On Friday, a judge in the case denied the plaintiffs’ request to issue an injunction blocking the law from taking effect.

The legislation that extends the statute of limitations for legal action by those alleging child sexual abuse is not retroactive and applies only to victims who were 18 or younger at the time the bill became law.

Del. C.T. Wilson (D-Charles), who testified before lawmakers for years that he was raped decades ago by his adoptive father, had long worked to get the legislation passed.

The ethics law increases financial disclosure requirements and expands the definition of what constitutes a conflict of interest.

The main provisions of the Justice Reinvestment Act, the criminal-justice reform law approved by the General Assembly in 2016, also take effect this year.

Although the law was passed last year, the effective date for most of its provisions was put off until this year to give the state time to prepare for a significant shift for minor drug offenders, who instead of incarceration will now be sentenced in many cases to drug treatment.

Also under the legislation, nonviolent offenders who have been given severe penalties over the past three decades will be able to appeal to judges to get out of prison years ahead of schedule.

Under the law affecting driving records, the state will automatically remove violations that are eligible for expungement, eliminating the need for individuals to apply for such action. Additionally, a nondriving offense that can result in suspension or revocation of a driver’s license, such as failure to pay child support or failure to appear in court, will no longer delay expungement of traffic-related infractions.

The changes, which are expected to affect more than 600,000 Marylanders, were designed in part to remove barriers to employment for those who are applying for jobs that require driving and have not had traffic-related violations in more than three years.

The fracking ban effectively makes permanent a moratorium on the controversial method for extracting natural gas.

Fracking, which has shown the greatest potential in Garrett and Allegany counties, involves injecting water, sand and chemicals deep into the ground at high pressure to fracture rock formations, thereby releasing natural gas trapped in pockets in the rock.

Advocates say the practice provides an energy source that is cleaner than coal, but opponents have raised concerns about the potential for water contamination, greenhouse-gas emissions and earthquakes.

New York and Vermont are the other states that have banned fracking, with an executive order and with legislation, respectively. Maryland is the first state with gas reserves to pass a ban through legislative action.

Josh Hicks contributed to this report.