This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Editor’s note: This story has been updated to reflect current vote totals as of Monday evening.

SAN DIEGO — Early results are in for one of the most consequential local contests in the June primary election: the race to become San Diego County’s next sheriff.

Undersheriff Kelly Martinez has built a lead with nearly 38% of the early vote, according to data released by the San Diego County Registrar of Voters Monday.

Chief criminal prosecutor John Hemmerling had about 20% of the early vote, with retired sheriff Cmdr. Dave Myers close behind at about 18%.

Many ballots remain to be counted, but the early results indicate a close contest for second place. The top two candidates will move on to a run-off contest in the November general election.

The sheriff oversees a staff of more than 4,600 people, who carry out law enforcement duties in nine cities and more unincorporated communities across San Diego County. Critically, they also run the jail system. That’s taken center stage since the release of a scathing state audit on the unusually high number of inmate deaths at local facilities.

Former Sheriff Bill Gore abruptly announced in January that he would retire the following month, rather than finishing his full term. The day he picked to walk off the job was the day the state released its jail deaths report. The race to replace him has since been defined by that state audit, and how to address the issues it raised.

Martinez is the first woman to serve as undersheriff in San Diego County. Now she’s vying to become the first woman in the region with the department’s top job.

Martinez has touted the department’s achievements during her tenure but also acknowledged the need for change, especially on the issue of jail deaths. She says recent steps have already increased safety and transparency, and that they are just the start for department-wide strides under her watch.

She has Gore’s endorsement and that of many high-profile local Democrats, including San Diego Mayor Todd Gloria and Board of Supervisors Chair Nathan Fletcher.

The lone Republican among the top vote-getters, Hemmerling is a former U.S. Marine Corps officer who now works as a deputy city attorney. The Union-Tribune endorsed him but later rescinded that selection, citing “anti-transgender remarks” he made at a candidate forum April 30.

Hemmerling says his experience running a prison compound for detainees in Iraq without incident demonstrates what makes him uniquely suited for tackling the county’s jail problem. He pitches himself as an outsider who can bring new perspective to the department.

Hemmerling is the choice of the Republican Party of San Diego County and the Deputy City Attorney’s Association, among other endorsements.

Myers is arguably the campaign’s most sustained and vocal critic of Gore’s legacy. The San Diego Union-Tribune and other outlets have chronicled his acrimonious relationship with his former boss, who he unsuccessfully ran against while still serving as Gore’s deputy.

Myers has promised to shake things up at the department, with a “top-down review” of all policies and procedures. He has targeted what he calls a “culture of cover-ups” on issues ranging from the jail deaths to racial disparities in policing, and promised to aggressively address them.

Myers’ endorsements include the San Diego County Democratic Party, Rep. Sara Jacobs and Rep. Mike Levin.

Myers and Martinez are registered Democrats and Hemmerling is a registered Republican, though the position is officially nonpartisan.