Afghanistan have signed long-delayed security treaties with the United States and NATO that will allow international troops to stay in the country beyond 2014.
U.S. President Barack Obama hailed the move as a "historic day" in the partnership between the two countries.
The Bilateral Security Agreement, BSA, will allow nearly 10,000 U.S. troops to remain in Afghanistan after the international combat mission ends on December 31.
But the size of the force will be reduced by half by the end of 2015 before a complete pullout scheduled by the end of 2016.
Obama said the agreement "represents an invitation from the Afghan government to strengthen the relationship we have built over the past 13 years."
The document was signed by National Security Adviser Hanif Atmar and U.S. Ambassador James Cunningham in a televised ceremony at the presidential palace on September 30, one day after President Ashraf Ghani was inaugurated.
Ghani's predecessor, Hamid Karzai, had long refused to agree to the deal, souring his ties with the United States.
Ghani, who was present at the signing ceremony, said the agreement is “for the good of our people, the stability of the region, and the world."
The president added that it will allow continued U.S. funding for the 350,000-strong Afghan security forces.
Cunningham said Afghan security forces have demonstrated "their resolve and capability." "This agreement will enable the United States to help (them) to build on this progress after the ISAF mission comes to a close."
He said the deal would also open the way for further support in health, education, and women's issues in Afghanistan.
In a statement emailed to the media on September 30, the Taliban described the pact as a plot by the United States to control Afghanistan.
Kabul also signed a agreement with NATO on September 30 to allow 4,000 to 5,000 additional troops -- mostly from Britain, Germany, Italy, and Turkey -- to stay in Afghanistan in a noncombat role after 2014.
The United States had threatened to pull out all its forces if the BSA were not signed.
On September 29, U.S. House Armed Services Committee Chairman, Representative Howard McKeon, a Republican from California, said that he hoped Obama will view the signing of the BSA as a "roadmap for a robust continued engagement, and not a path to a premature withdrawal."
Analysts say relations between Washington and Kabul should improve under Ghani, a 65-year-old technocrat who worked at the World Bank.
In his inaugural speech, Ghani said his priority is to bring peace to the country.
"We ask opponents of the government, especially the Taliban and Hezb-e-Islami (another militant group), to enter political talks," Ghani said after being sworn in.
"Any problems that they have, they should tell us, we will find a solution" he added.
Ghani's first act in office was to swear in his defeated rival, Abdullah Abdullah, who became the country's first chief executive.
Creating the post was part of a power-sharing deal worked out between Abdullah and Ghani, ending months of uncertainty in Afghanistan following a disputed runoff vote.
Ghani was officially declared the winner of the presidential election on September 21, some three months after the second round of the election was conducted.
With reporting by AFP and AP