Scott Allen maintained a comfortable lead throughout the night in the 97th Assembly District race.
But his victory wasn't official until just after midnight Wednesday morning, more than four hours after the polls closed.
With 2,003 votes or 34 percent of the vote, Allen separated himself from the pack to win the crowded six-person Republican primary.
His closest challenger was Humana consultant Brandon Rosner, who finished with 1,714 votes or 29 percent of the vote.
The next four candidates were far behind. City of Waukesha alderwoman and county board supervisor Kathleen Cummings finished third with 742 votes (13 percent), GOP activist Vince Trovato fourth with 727 votes (12 percent), city of Waukesha alderman Aaron Perry fifth with 428 votes (7 percent) and former town of Waukesha supervisor Joe Banske sixth with 300 votes (5 percent).
All of the candidates were city or town of Waukesha residents.
Allen, a former city of Waukesha alderman, will appear on the general election ballot in November.
But with no Democratic challenger, Allen essentially became the district's new state representative after winning the primary.
The district covers the southern half of the city of Waukesha, the southwestern portion of the town of Waukesha, the southeastern portion of the town of Genesee and the northeastern portion of the town of Mukwonago.
The voting totals for the town of Genesee, town of Mukwonago and town of Waukesha came in relatively quickly on Tuesday night.
But it was a very slow process for the city of Waukesha to report its totals and the final totals didn't come in until after 12:15 a.m. Wednesday.
Allen, a sales director for Shorewest Realtors, spent three years on the Waukesha Common Council from 1998-2001, was on the board of directors for the Waukesha Civic Theatre and is currently serving on the Waukesha County Community Development Block Grant Board.
Allen, who has a degree in political science from UW-Milwaukee and two master’s degrees: one in public administration and another in urban planning, spent six years in the U.S. Army Reserve and is a recipient of the Wisconsin Reserve Military Achievement Award.
He replaces Rep. Bill Kramer (R-Town of Waukesha), who did not seek re-election amid sexual assault charges.
A jury trial for Kramer is scheduled to begin on Oct. 28 at the Waukesha County Courthouse.
Kramer, previously on the Waukesha County Board from 1998-99 and 2004-07, has served in the state assembly since 2006.
He was named Republican majority leader in September 2013, but was ousted from that position in early March over allegations that he sexually harassed one woman and inappropriately touched another on a trip to Washington, D.C., earlier this year.
Kramer was then charged in the spring with two felony counts of second-degree sexual assault on allegations of groping a female legislative staffer three years ago in Muskego after a Pints and Politics event hosted by the Republican Party of Waukesha County.