A gathering of leaders from NATO countries this week was supposed to be an opportunity to celebrate the close of the alliance’s long war in Afghanistan and to embrace the country’s new president.

But it’s hard to have a party without the guest of honor.

Despite smiling promises to Secretary of State John F. Kerry last month, two rival candidates to succeed Afghan President Hamid Karzai have failed to resolve a disagreement over a review of disputed election results in time to declare a winner. As a result, there will be no Afghan head of state at the NATO summit in Wales.

NATO Secretary General Anders Fogh Rasmussen made the best of a disappointing situation at a news conference Monday.

“We have done what we set out to do,” Rasmussen told reporters in Brussels. “We have denied safe haven to international terrorists. We have built up capable Afghan forces of 350,000 troops and police. So our nations are safer, and Afghanistan is stronger.”

An Afghan election commission worker, left, sorts ballots for an audit of the presidential runoff votes in front of international observers at an election commission office in Kabul. (Massoud Hossaini/Associated Press)

For more than a year, the plan had been to use the meeting as a symbolic pivot to a new relationship with Afghanistan, where forces from across the Euro-Atlantic alliance have fought Taliban militants since 2001.

Nearly 3,500 foreign troops have died in the war, most of them Americans. The war is broadly unpopular with European publics, and alliance leaders have struggled for years to justify the expense and loss of life. Some NATO nations pulled troops out of Afghanistan early, and others are counting the minutes until Dec. 31, when the combat mission is formally scheduled to end.

Now, however, political uncertainty in Kabul hangs over that fast-approaching deadline. NATO diplomats privately say the power vacuum confirms their worst fears about an unstable partner.

“It’s hard to argue that they deserve the help, even though they do,” lamented one Western European diplomat with years of involvement in Afghan affairs.

The NATO summit was supposed to cap the nearly 14-year mission with a formal announcement that Afghan security forces are fully in control and will be helped in the future by only a small force of international trainers and advisers.

The summit would also serve to remind international donors of their pledges to keep supporting Afghanistan.

That the conference is likely to be held without any clear end in sight to the electoral impasse will hardly inspire confidence in NATO members, said Andrew Wilder, the vice president of South and Central Asia programs at the U.S. Institute of Peace.

“The dangerous game of brinksmanship that Afghanistan’s would-be presidents and their power brokers are playing in Kabul has squandered away an extremely important opportunity for Afghanistan to start the process of rebuilding its critically important relationship with NATO — and the U.S. in particular,” Wilder said.

The Obama administration may have lost much of its leverage over the next Afghan government — whoever leads it — by repeatedly allowing deadlines related to the NATO mission and the election to slip. For months, U.S. officials urged Karzai to sign a military agreement with Washington that would govern how U.S. forces could operate in Afghanistan after 2014 and insulate them from Afghan legal claims.

Karzai refused to sign, despite warnings that, by doing so, he was imperiling the planning necessary for a post-2014 force.

Each of the candidates vying for the Afghan presidency, Ashraf Ghani and Abdullah Abdullah, agreed long ago to sign the security agreement as among his first acts as president. With no declared winner, however, there is still no signed security agreement. NATO’s own security agreement, to be patterned on the U.S. plan, is on hold as well.

While visiting Kabul last week, Gen. Martin Dempsey, the chairman of the Joint Chiefs of Staff, said the Pentagon has developed plans that would allow American troops to remain in Afghanistan even if the electoral crisis persists “a little further than we hoped it would.”

Karzai, who had planned to hold the presidential inauguration last weekend, has barely been mentioned by U.S. officials for months, while all eyes remain on the pair of well-respected candidates vying to replace him.

Abdullah’s campaign team has demanded procedural changes to the ongoing vote audit and threatened to pull out of the U.N.-administered review. Abdullah alleges widespread fraud in the June 14 second round of voting, in which Ghani came out ahead by a margin that surprised some observers.

Abdullah and Ghani have promised to form a unified government, with the exact terms left vague, once the audit is complete. They appeared together with Kerry during an emergency visit by Kerry to Kabul in August and clasped hands to pledge cooperation.

Meanwhile, Karzai has said he will not attend the NATO summit, to the relief of alliance leaders. The Afghan defense minister is likely to attend instead, with little fanfare.

Plans to fete the new leader and hold photo ops with President Obama and others were scrapped last week, although some could be revived if Afghanistan somehow declares a victor early this week.