TAMPA — In a stunning election-night upset, former federal prosecutor and political newcomer Andrew Warren narrowly defeated longtime incumbent Mark Ober to become Hillsborough County's new State Attorney.With all precincts counted, results showed Ober with 49.5 percent of the vote to Warren's 50.4 percent. Ober trailed Warren by about 4,700 votes.The outcome remained too close to call for much of the evening, with the candidates consistently neck-and-neck. But a final batch of mail ballots just after midnight made Warren's victory clear."I'm thankful for all the support I received from throughout the county," Warren said from his home in Tampa. "This is just the beginning. We have a lot of work to do tomorrow."Ober could not immediately be reached for comment. He spent the evening surrounded by fellow lawyers and other supporters at the TPepin's Hospitality Centre in east Tampa.The results marked the end of a hard-fought campaign in which Warren often put the widely respected Ober on the defensive. Warren, 39, repeatedly assailed Ober's tenure in office, seeking to portray him as out of touch and insensitive to crime victims. It was, at times, downright nasty.Early in the campaign, Warren accused the incumbent of rarely showing up for work. As evidence, he presented a month's worth of Ober's electronic key card data, obtained through a public records request, which showed Ober only used his card five times to get into the building where he works. Ober countered that there are ways to get into the building without using the card and that he often works elsewhere.Later in the campaign, Warren criticized Ober for comments he made about a sex crime case his office handled. Warren also dredged up the office's handling of a long-resolved sex case involving Plant High School students to try to portray him as unsympathetic to victims and not aggressive against sex criminals.Ober said Warren was exaggerating and misrepresenting both cases for political gain. But while he defended himself, Ober strayed away from directly criticizing his opponent.Instead, he touted his nearly four decades of experience as both a prosecutor and defense attorney.He drew heavy support from both local law enforcement and many of the area's prominent defense attorneys. On social media and at public events, Ober and his supporters held signs with the slogan: #ExperienceMatters.Warren positioned himself as a progressive reformer. On the campaign trail, Warren said he ran because he wanted to be a voice of leadership in a national conversation about the criminal justice system. He pledged a renewed focus on rehabilitation and reducing recidivism among criminals.Contact Dan Sullivan at [email protected] or (813) 226-3386. Follow @TimesDan.