Republicans and Democrats in Arizona reached an agreement in court Friday that gives all counties in the state until this coming Wednesday to address problems with ballots, as vote tallying for the state's tight Senate race continues.

As of 8:15 p.m. ET Friday, Democratic candidate Kyrsten Sinema led Republican candidate Martha McSally by roughly 20,000 votes statewide, according to the Arizona Secretary of State's Office. Sinema has received 991,189 votes and McSally 970,986, the office said.

As the ballot count continued, Sinema for Arizona campaign manager Andrew Piatt issued a statement saying: “Once again, today’s data confirmed our expectation that as the ballots are counted, Kyrsten will steadily build her advantage and be elected to the U.S. Senate. Nine counties reported today - five of which are counties where McSally is favored and where she needed to perform very well in order to regain even a narrow path to victory. That didn’t happen and since election night, Kyrsten netted 38,258 votes and now is leading by 20,203 votes - or 1 percent. She will win this race.”

The settlement comes after Republicans filed a lawsuit Wednesday in a bid to prevent Maricopa and Pima counties – the two biggest counties in the state – from using procedures that permit mail-in ballot fixes to occur beyond Election Day, arguing that the practice was improper.

Four local Republican parties filed the lawsuit.

FLORIDA AT CENTER OF EXPLOSIVE POST-ELECTION FIGHT, AS NEW ARIZONA SENATE TALLY GIVES EDGE TO DEM

If the signature on the voter registration doesn't match that on the sealed envelope, both Maricopa and Pima County allow voters to help them fix, or "cure" it, up to five days after Election Day.

Many other counties allow voters to cure only until polls close on Election Day.

However, now all counties may cure ballots until Wednesday.

Roughly 272,000 votes remained uncounted, the Arizona Secretary of State's Office reported Friday.

JUDGE SIDES WITH FLORIDA’S RICK SCOTT, CITES ‘VIOLATION’ OF STATE CONSTITUTION BY ELECTION OFFICIALS

“We know there's urgency out there, but we want to get it right, not quick,” Maricopa County Recorder Adrian Fontes said, according to the Associated Press.

President Trump tweeted about the Arizona election ahead of Friday’s settlement.

“Just out — in Arizona, SIGNATURES DON’T MATCH. Electoral corruption - Call for a new Election? We must protect our Democracy!”

The agreement would affect only a few thousand votes, the AP reported.

Fox News’ Dan Springer, Melissa Chrise and The Associated Press contributed to this report.