US President Joe Biden has said that Afghans “are going to have to decide their future” as Afghan President Ashraf Ghani visited the White House.
Mr Biden promised continued support for the country, even though US and Nato troops are set to finish their withdrawal on 11 September.
It comes as hardline Islamist Taliban fighters have captured dozens of districts in a recent offensive.
Earlier this week the UN expressed alarm at their gains.
The meeting came the day after the US announced plans to evacuate thousands of Afghans who worked for the US military ahead of the withdrawal. Many fear reprisals from the Taliban.
US and Nato officials have recently said that the Taliban have so far failed to live up to commitments to reduce violence in Afghanistan.
Speaking in the Oval Office on Friday, Mr Biden said the partnership between the US and Afghanistan would continue.
“Our troops may be leaving, but support for Afghanistan is not ending,” he said.
But he stressed that it was up to Afghans to decide “what they want”, adding: “The senseless violence, it has to stop. It’s going to be very difficult.”
Mr Ghani meanwhile said that he supported Joe Biden’s “historic” decision to withdraw US troops, saying he was there to “respect it and support it”.
He also announced that Afghan security forces had recaptured six districts, reversing some recent Taliban gains.
“You will see that with determination, with unity and with the partnership, we will overcome all odds,” he said.
The Afghan president – accompanied by Abdullah Abdullah, government chief executive – met members of Congress, the CIA and the US defence secretary on his two-day trip to the US capital.
Afghans know Joe Biden speaks his mind. As a senator, he famously walked out of a dinner in Kabul with then President Hamid Karzai.
This White House meeting comes at a pivotal moment. There would have been a clear message that arguing Afghan leaders had to forge a united front. That demands a lot of President Ghani; it’s why Dr Abdullah was invited too.
Also on the agenda were the worrying weaknesses in Afghan security forces, including the maintenance of helicopters, as they confront escalating Taliban attacks.
President Biden emphasised it was up to Afghans now. But he also hinted in his public remarks at helping with “the tools you need”.
Even at this 11th hour, as the last US soldiers pack up, a lot is still undone on how and where some critical military support will continue.
In President Ghani’s words, it’s a “a new chapter”; both sides have a big stake in how it ends.