Gov. Tom Wolf's administration is settling a vote-counting lawsuit stemming from the 2016 presidential election, in part by affirming a commitment it made previously to push Pennsylvania's counties to buy voting systems that leave a verifiable paper trail by 2020.

Paperwork filed Thursday in federal court in Philadelphia caps a lawsuit that Green Party presidential candidate Jill Stein filed in 2016 as she sought recounts in Wisconsin, Pennsylvania and Michigan.

All three states had a history of backing Democrats for president before they were narrowly and unexpectedly won by Republican Donald Trump over Democrat Hillary Clinton.

Months ago, Wolf, a Democrat, began pushing counties to upgrade to voting machines that leave a paper trail as a safeguard against hacking by 2020. Four in five Pennsylvania voters use machines that lack an auditable paper trial.

In the settlement, Wolf underscores that commitment "so that every Pennsylvania voter in 2020 uses a voter-verifiable paper ballot." The settlement also requires the state to direct counties to audit the 2022 election result before it is certified, based on recommendations from a working group the state must assemble by Jan. 1.

Ilann Maazel, a lawyer for Stein and a handful of registered Pennsylvania voters, who sued on Thursday, called the agreement "a major step forward for Pennsylvania voters and election integrity."

The lawsuit had accused Pennsylvania of violating the constitutional rights of voters because its voting machines were susceptible to hacking and barriers to a recount were pervasive.

In September, U.S. District Judge Paul Diamond had denied the Wolf's administration effort to dismiss the lawsuit's claims that the continued use of paperless voting machines may violate the constitutional rights of voters. Diamond, however, will retain jurisdiction to enforce the provisions of the settlement.

Pennsylvania is one of 13 states where most or all voters use antiquated machines that store votes electronically without printed ballots or other paper-based backups that could be used to double-check the vote, according to researchers at New York University's Brennan Center for Justice.