CAMP DAVID, Maryland — U.S. and Afghan leaders laid the groundwork Monday for new relations between the two countries that have been linked for years as war partners, including plans to seek American funding to maintain an Afghan security force of 352,000 and discussions about future U.S. troop levels as the war winds down.

The all-day session at Camp David in Maryland included dozens of U.S. and Afghan officials, including Secretary of State John Kerry, Defense Secretary Ash Carter, Afghan President Ashraf Ghani and chief executive Abdullah Abdullah. The talks were aimed at relaunching a U.S.-Afghan relationship strained by nearly 14 years of war and America’s often-testy relations with the former president, Hamid Karzai.

During the meeting, the U.S. agreed to seek funding through 2017 for an Afghan force of 352,000, a level the nation has yet to meet. U.S. administration officials said the Afghan government is trying to improve recruiting to make up for security forces who leave the service or simply abandon their jobs.

They also agreed to require the Afghan government to complete specific reforms and meet other milestones in exchange for up to $800 million. U.S. officials said the Afghans suggested the incentive-based funding idea. The leaders of the two nations also said they would restart routine ministerial-level Defense and State Department meetings.

Ghani is expected to meet with President Obama on Tuesday, a meeting in which officials expect the U.S. to make clear its decision to slow the pace of the withdrawal of American troops from Afghanistan.

Obama has promised to pull all remaining troops out by the end of his presidency. But deficiencies in the Afghan security forces, heavy casualties in the ranks of the Afghan army and police, a fragile new government and fears that Islamic State fighters could gain a foothold in Afghanistan have combined to persuade Obama to slow the withdrawal.

Instead of trimming the current U.S. force of 9,800 to 5,500 by the end of this year, U.S. officials say the administration now might keep many of them there well into 2016. Obama has said that after that, the U.S. will maintain only an embassy-based security force in Kabul of perhaps 1,000 troops.

Ghani, who has expressed worries about Islamic State militants trying to gain a foothold in his country, has pressed to keep more U.S. troops there longer, but Obama has promised to end both wars in Afghanistan before his presidency ends in January 2017.

During a visit to the Pentagon Monday, Ghani thanked U.S. troops and taxpayers for their sacrifices in nearly 14 years of war. He pledged that his impoverished country will not remain a burden to the West.

“We do not now ask what the United States can do for us,” Ghani said in remarks meant to bolster the Obama administration’s conviction that he is a reliable partner worth supporting over the long term. “We want to say what Afghanistan will do for itself and for the world,” he added. “And that means we are going to put our house in order.”

It was a poignant setting for the start of Ghani’s visit. On Sept. 11, 2001, terrorists hijacked an American Airlines jetliner and flew it into the Pentagon, killing all aboard and 125 people in the building. The U.S. responded to the attacks on Washington and New York’s World Trade Center by invading Afghanistan a month later, beginning the longest war in American history.

On arrival at Camp David, Ghani emphasized what he called a new phase of the U.S.-Afghan relationship.

“It’s time for Afghanistan to reciprocate the gift that the United States has so generously provided over the years,” he said. “Reciprocating the gift means owning our problems, solving them and asking of ourselves what we must do for ourselves and for the region.”

At the Pentagon ceremony, Carter praised Ghani as a committed leader who knows that “Afghanistan’s future is ultimately for the Afghans to grab hold of and for Afghans to decide.”

Those themes emphasized by Carter and Ghani – that Kabul’s new leaders are more reliable and appreciative of U.S. assistance and that the U.S. alone cannot solve Afghanistan’s problems – are central to the administration’s approach to carrying out Obama’s pledge to end the war.

Ghani proclaimed at the Pentagon ceremony that the U.S. is supporting the winning side.

“We die. But we will never be defeated,” Ghani said. “Terrorism is a threat. It’s evil. But we the people of Afghanistan are willing to speak truth to terror by saying no, you will never overwhelm us, you will never subdue us. We are going to overcome.”

“And in this endeavor our partnership with the United States is foundational because we will be the first line of defense for freedom globally,” he added.

Ghani’s relationship with Washington stands in stark contrast to that of his predecessor, Karzai, whose antagonism toward the U.S. culminated in a refusal to sign security agreements with Washington and NATO before leaving office last year. Ghani signed the pacts within days of becoming president in September, and he has since enjoyed a close relationship with American diplomats and military leaders.