TOPEKA, Kan. — The counting of the last ballots in the tight and contentious Republican primary for Kansas governor will stretch out over the next week and still might not settle the race.

Kansas Secretary of State Kris Kobach leads Gov. Jeff Colyer by 110 votes out of 313,000-plus cast after late mail-in ballots from all 105 counties were added Friday to totals from advance voting and ballots cast at the polls Tuesday. The state's 105 counties still must review nearly 9,000 provisional ballots and determine how many of them were cast in the Republican primary — and how many will be counted. They have until Aug. 20 to finish that process and certify their local results.

A look at the process for counting the remaining votes and a possible recount:

MAIL-IN BALLOTS

The Legislature last year changed the state's law on mail-in ballots so that they were to be counted if they were postmarked Tuesday, the day of the primary, and arrived by Friday. Previously, they had to arrive by Election Day, and in the 2016 general election, more than 500 arrived afterward, said Bryan Caskey, the state elections director in the secretary of state's office.

WHO COUNTS

While Kobach's office provides guidance on the handling of ballots and supervises the counting, the work is done by the counties.

The chief elections officer in each county appoints a bipartisan board of election workers to handle the individual ballots.

The secretary of state appoints an election commissioner in the state's four most populous counties, Johnson, Sedgwick, Shawnee and Wyandotte, and the chief elections officers in the other 101 are elected clerks.

The elections chiefs present their workers' recommendations on whether provisional ballots should be counted to the county commission, which then decides and certifies the final results.

PROVISIONAL BALLOTS

Voters receive provisional ballots at the polls when election workers are not sure they are eligible to vote at that location, or at all. Those ballots are sealed in envelopes and set aside to be reviewed later, with notes about the issues involved. The eligibility of the voters is determined before workers unseal the ballots. Once a ballot is unsealed, workers can see whether it was cast in the Republican or Democratic primary before counting any relevant votes.

Kobach said based on past elections, it's likely that about two-thirds of 9,000 provisional ballots that were filled out Tuesday were cast in the Republican primary and that a majority of them will be counted.

COUNTING DAYS

State law says counties can begin their canvassing Monday. Seventy-six counties plan to start then, including Johnson and Sedgwick.

An additional 14 plan to start Tuesday, two on Wednesday and six on Thursday, including Shawnee and Wyandotte counties. Rooks County in northwest Kansas has scheduled its canvassing for Friday, and six counties have set it for Aug. 20, the deadline to finish.

REQUESTING A RECOUNT

Under a Kansas law specific to statewide races, a candidate must ask for a recount by 5 p.m. Friday. State law has no provision for an automatic recount, no matter how close the race.

A candidate can ask for a recount no matter how large the margin, but he or she must put up funds to cover the full cost of the recount. If the recount changes the result, the candidate seeking it gets his or her money back, and the counties and state cover their costs.

The candidate can seek a recount in only one or a handful of counties, dozens of counties, or statewide. Also, the candidate chooses whether the recount will be machine re-scanning of paper ballots or a hand count of those ballots.

The cost of the recount is determined by the secretary of state's office. Caskey said the office would survey the counties involved in a recount for their estimated costs, then add "a small amount" to cover the state's administrative expenses.

There's no frame of reference for what a recount would cost because there hasn't been one in a statewide race in at least several decades.

A recount must start the day after the candidate requests one, even if the work would start on a Saturday. Counties involved have five days to finish, meaning all of it would be done by Aug. 22 at the latest.