KABUL, Afghanistan — Afghanistan's election commission said the president has won a second term, earning 50.64 percent of a preliminary vote count announced Sunday, but his opponents can still challenge the results.

The Sept. 28 presidential poll results have been repeatedly delayed amid accusations of misconduct and technical problems with counting ballots.

Ashraf Ghani appears to have beaten out his main challenger Abdullah Abdullah, who serves as the country’s chief executive in a fragile national unity government.

If the preliminary results hold and Ghani remains president, it could give him the authority he's been seeking to demand a leading role in peace talks with the Taliban.

Ghani and his government have been sidelined during the past year of direct talks between the U.S. and the Taliban. Washington seeks to withdraw its combat troops and end 18 years of fighting in Afghanistan, America's longest war.

Abdullah's office released a statement saying the results were “not legitimate.”

“We will never accept results based on the fraudulent vote without considering the legal demands of the candidates," the statement said.

U.S. Ambassador to Afghanistan John R. Bass tweeted: “It’s important for all Afghans to remember these results are preliminary. Many steps remain before final election results are certified, to ensure the Afghan people have confidence in the results.”

Trump announced talks with the Taliban were back on during a Thanksgiving trip to visit American troops in Afghanistan, less than three months after he suddenly called off official negotiations. Tom Brenner / Reuters file

Afghanistan's election commission tried to launch a ballot recount in November but Abdullah halted the attempt, saying he wouldn’t let his observers participate. He eventually allowed a recount to go forward earlier this month.

Thousands of Abdullah’s supporters had rallied in November against what they said was the presence of faked ballots. The controversial recount seemed set to favor Ghani.

The 2014 presidential election was mired in accusations of widespread fraud.

That led the U.S. to cobble together a unity government between Ghani and Abdullah, the two leading contenders. Their partnership has been fraught with bickering and rifts.

It's not clear how the Taliban will respond to Ghani's win.

Ghani has been demanding a ceasefire before engaging in talks, something the Taliban have steadfastly refused.

The Taliban currently control or hold sway over half the country.

Hawa Alam Nuristani, the head of the Independent Election Commission, announced the preliminary results at a press conference in Kabul Sunday.

She did not specify when the final results will be given. The preliminary vote count was originally set to be announced Oct. 17, and the final tally on Nov. 7.

There also won't be any decision on whether a second round of voting is needed until the final results are out, and Ghani's lead of over 50 percent is secure. Afghanistan's election laws say a runoff must take place if no candidate obtains over 50 percent of the votes.

The preliminary results found Ghani won 923,868 votes — 50.64 percent — while Abdullah won 720,990 votes, according to Nuristani.

She did not give a specific percentage for Abdullah during the press conference in the capital, Kabul, but he appeared to have received 39.52 percent.

The U.N. secretary-general's special representative for Afghanistan, Tadamichi Yamamoto, said the electoral commission "has an obligation to adjudicate any complaints it receives transparently and thoroughly so the election process may conclude in a credible manner.”

“All candidates have the chance to raise any concerns they may have," he said in a statement.