HARRISBURG, Pa. (AP) — Heart surgeon-turned-TV celebrity Dr. Mehmet Oz and former hedge fund CEO David McCormick went into Wednesday essentially tied in Pennsylvania’s hotly contested Republican nomination for an open U.S. Senate seat, expected to be among the nation’s most competitive races in the fall.

The contest was within a couple thousand votes overnight, out of more than 1.2 million cast. Trailing in a distant third place in the seven-person GOP primary field was conservative activist Kathy Barnette.

The Associated Press has not called the race. Some counties had yet to tabulate all of their mail-in ballots and the counting of provisional, overseas and military absentee ballots could last all week.

There is no runoff law in Pennsylvania. But the race was close enough to trigger Pennsylvania’s automatic recount law, with the separation between Oz and McCormick inside the 0.5% margin that triggers an order by the state’s top election official.

Oz and McCormick emerged at their election night watch parties after midnight to say they would have to wait for vote counting to resume Wednesday to determine a winner, with each saying he was confident of victory. There are no plans for either candidate to make a public appearance, though former President Donald Trump has encouraged Oz to preemptively declare victory. Oz has not made any suggestion that he will do so.

The state’s lieutenant governor, John Fetterman, won the Democratic nomination hours after undergoing surgery to implant a pacemaker with a defibrillator to help him recover from a stroke he suffered on Friday.

Democrats view the race to replace retiring two-term Republican Sen. Pat Toomey as perhaps their best opportunity to pick up a seat in the closely divided 100-seat Senate.

Republican turnout exceeded 37%, the highest midterm primary turnout in at least two decades, juiced by more than $70 million in spending on the GOP primary alone.

Oz has been helped by an endorsement from Trump, while a super PAC backing McCormick weighed in heavily in the race, spending about $20 million, much of it to attack Oz.

Both men spent millions of their own dollars on the campaign, as well, and battled accusations of being carpetbaggers — Oz moved from a mansion in New Jersey overlooking Manhattan to run, and McCormick moved from Connecticut’s ritzy Gold Coast.

Oz, best known as the host of daytime TV’s “The Dr. Oz Show,” has battled misgivings among conservative groups about his positions on guns, abortion and other core conservative issues. Oz countered that Trump’s endorsement guaranteed that he was a conservative.

Oz also was attacked repeatedly for his dual citizenship in Turkey, and he accused McCormick of making “bigoted attacks.” If elected, Oz would be the nation’s first Muslim senator, although he has not campaigned on that milestone. Oz, who was born in the U.S., said he would renounce his dual citizenship in Turkey if he is elected.

Get daily updates on local news, weather and sports by signing up for the WTAJ Newsletter.

McCormick is a decorated U.S. Army combat veteran who has strong connections to the party establishment going back to his service in President George W. Bush’s administration.

However, McCormick spent much of the campaign fending off accusations from rivals that he would be soft on China after leaving a hedge fund, Bridgewater Associates, which does considerable business inside China with the blessing of the government there.

Trump had attacked McCormick repeatedly in the final two weeks of the race, calling him a liberal, a sellout to China and part of a corrosive Washington establishment that is not “America First,” Trump’s label for his governing philosophy.

Nevertheless, McCormick had insisted that he was the most “America First” candidate in the race and closed it by airing a TV ad showing a video clip of Trump in a private 2020 ceremony congratulating McCormick, saying “you’ve served our country well in so many different ways.”

Oz and McCormick had avoided repeating Trump’s unsubstantiated claims that Democrats stole the 2020 presidential election from him in the battleground state. But they defaulted to repeating Republican complaints about decisions by state judges and election officials in how to administer the election.