Afghanistan's supreme court on Sunday said it had extended the term of President Ashraf Ghani until delayed elections take place - resolving, for now, the question of what would happen after his term expires on May 22.
Presidential elections were initially slated for April 20, but Afghan election officials were unprepared for a new nationwide poll so soon after October parliamentary elections.
With some final results from that election still pending, the presidential poll was delayed until July 20, then pushed back again until September 28.
"The Afghan supreme court has extended the service term of President Ghani until the re-election of a new president," the court said in a statement.
"The supreme court understands the financial, security and logistical challenges faced by the election commission."
The delayed elections come as the US tries to negotiate a peace deal with the Taliban, and some had speculated the polls were being deliberately stalled to create more space for those talks.
Opposition politicians and presidential contenders had called for an interim government to fill the gap between Ghani's mandate expiring and the presidential elections.
The supreme court said it was asking "presidential candidates to respect the delay in the presidential elections."
Ghani was elected in 2014 in a closely contested poll that was mired by allegations of fraud and that saw him lead a power-sharing government.
Originally set for April 20, the elections were first delayed until July 20 and pushed back again to September 28.