Pat McCarthy, a Democrat, defeated State Sen. Mark Miloscia 53% to 47% in the race to replace embattled state auditor Troy Kelley Thursday afternoon.

The auditor’s office has been in a state of confusion for the past year, as Kelley faced a federal fraud trial on charges unrelated to his role as auditor.

Miloscia, a Republican from Federal Way, and McCarthy, currently the Democratic Pierce County executive, emerged as the leading candidates in the crowded race during the August primary.

Miloscia was elected to the State Senate in 2014. Before that, he spent seven terms in the State House. In the State House, Miloscia served as a Democrat.

In 2005, McCarthy was named the Washington State Auditor of the Year while serving as the Pierce County Auditor. Former Governor Chris Gregoire and King County Executive Dow Constantine were co-chairs on McCarthy’s campaign for state auditor.

Leading up to the election, Miloscia called for a statewide audit of homeless programs.

McCarthy emphasized financial audits as a significant responsibility of the state auditor. She also focused on the need for good leadership and transparent management in the state auditor’s office during her campaign.

The state auditor is a government watchdog role, performing objective audits and investigations on state agencies.