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 after Islamist Taliban fighters 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.