The Republican primary for Maine’s 1st Congressional District appeared headed for a recount Wednesday based on unofficial election results showing the two candidates were a few dozen votes apart.

Mark Holbrook of Brunswick was leading Ande Smith of North Yarmouth by a mere 58 votes out of 20,632 votes reported as of 5 p.m., making the race too close to call. Only one voting precinct, Isle au Haut, had yet to report Tuesday’s congressional primary results. And there were not enough registered Republicans on the small island community as of April to close the gap, according to returns tallied by the Portland Press Herald and The Associated Press.

Neither campaign was declaring victory or conceding the contest to decide who will challenge Democratic U.S. Rep. Chellie Pingree this fall in the historically left-leaning district.

“We’re thrilled,” Holbrook said late Wednesday morning. “We are anxiously awaiting the last precinct to report, but we will see what happens.”

“We are continuing to receive reports regarding voting totals, but we look forward to learning the official results from the Secretary of State’s Office,” Smith’s campaign manager, Nick McGee, said in a statement.

While official election results may not be available for weeks, the losing campaign would have five business days – until next Tuesday – to formally request a recount from the Secretary of State’s office based on the preliminary tallies reported by the district’s 162 precincts. Kristen Muszynski, spokeswoman for Secretary of State Matt Dunlap, said towns have until Friday to file their reports but that her office aims to provide the campaign with unofficial results by Monday.

“They have to file a (recount) request by Tuesday, so we’ll pull the numbers together by then,” Muszynski said.

The 50-50 split heightens the drama in a contest that saw repeated lead changes as election returns came in Tuesday night and Wednesday morning. The two men ran a lively and increasingly tense campaign in a district that has elected a Republican for only one two-year term since 1987.

Smith, 51, is a former nuclear engineer officer aboard Navy submarines and current captain in the Navy Reserve. An attorney who runs his own consulting firm focused on cybersecurity and technology, Smith argued that his 30-year Navy career as well as his experience in the private sector provided him with the “tools, knowledge and temperament” to lead in Congress. He currently serves on the Maine State Board of Education, but has not held elected office before.

Holbrook is a professional counselor who works with veterans, law enforcement personnel and families in his private practice. A former police officer for more than a decade, Holbrook also has worked as a lobsterman, a commercial diver and an instructor. And he described himself as “the only conservative choice in the race,” attempting to differentiate his hard-right stance from Smith’s on such issues as immigration, abortion and the Second Amendment.

Smith could not be reached for comment Wednesday, but Holbrook said he already had spoken with officials in the Secretary of State’s office about the recount process. If the current vote tally stands, Smith’s campaign would have to request the recount.

“Given my experiences with him, I would expect that he would request a recount,” Holbrook said.

If a recount is requested, the Maine State Police would collect all ballots and deliver them to “a secure storage area under the control of the State Police,” according to state election rules. The actual recount would involve one “counter” from each campaign as well as a “recount assistant,” and together the group would recount all ballots by hand. Campaigns may dispute ballots, with any disputed ballots set aside for further review by the group.

The public and media are allowed to observe the recount process.

Before 2007, Maine had an “automatic retrieval process” in which the State Police collected all ballots from any race in which the outcome was decided by less than 1 percent. But even then, a losing candidate was required to request the actual recount of ballots.

In this particular race, the state of Maine would pay for the recount because the voting gap is less than 1.5 percent.

Muszynski, the secretary of state’s spokeswoman, said recounts are less common in primary elections but that the office typically handles at least 10 recounts in a general election.

Throughout the campaign, Holbrook cast himself as the more conservative candidate while portraying Smith as the “establishment” candidate, in hopes of capitalizing on the current anti-establishment sentiment among voters. Smith, meanwhile, portrayed himself as an experienced leader with strong conservative credentials who had the right mix of experience to get things done in Congress.

While Smith had a more professionally run and better-financed campaign – receiving more than $130,000 in contributions as of the end of May – Holbrook announced his campaign roughly a year earlier, aired television commercials and had a large cadre of volunteers. He also hit the radio airwaves last week with an ad in which he claimed Pingree was already preparing for a race against him, citing a Pingree campaign fundraising appeal that mentioned him.

Pingree did not face an opponent in Tuesday’s Democratic primaries and has done little public campaigning to date.

“The process in the Republican primary is still not complete and right now Congresswoman Pingree is focused on her work representing Maine in Washington,” Pingree spokesman Willy Ritch said in a statement.

The preliminary vote totals show Smith polled well in some of the district’s larger towns, but that Holbrook picked up more votes in many of the coastal communities north of Freeport. Both did well in their respective backyards.

For instance, Smith trounced Holbrook 384 to 46 in his hometown of North Yarmouth, and also soundly defeated his opponent in Yarmouth, Portland, South Portland, Cape Elizabeth and Gorham. Holbrook, meanwhile, outpolled Smith 230 to 166 in his hometown of Brunswick, and also did well in the surrounding communities of Topsham, Bath, Harpswell, Woolwich and Bowdoin.

In what appears to have been a key difference, Holbrook made up for losses to Smith in some of the district’s larger towns by beating his opponent by significant margins in town after town along the coast, especially in the Midcoast region. For example, Holbrook beat Smith 175 to 80 in Wiscasset and 141 to 65 in Camden.

The candidates tied each other in York with 73 votes apiece and in Newcastle with 29 each.