Update at 9:55 a.m. ET

Afghanistan has signed a pact with the U.S. to allow about 10,000 troops to remain in the country after the end of the year, when most American forces are to be withdrawn.

The country's newly inaugurated president, Ashraf Ghani, signed the Bilateral Security Agreement, or BSA, which would leave in place the U.S. troops and a few others from NATO allies to bolster Afghan forces.

"This agreement is only for Afghan security and stability," said Ghani, who was sworn in on Monday. "These agreements are in our national interest. The Bilateral Security Agreement will pave the ground for Afghanistan to take control," he added.

Ghani's predecessor, Hamid Karzai, had refused the deal.

The White House released a statement calling the agreement "historic."

"This agreement represents an invitation from the Afghan Government to strengthen the relationship we have built over the past 13 years and provides our military service members the necessary legal framework to carry out two critical missions after 2014: targeting the remnants of Al Qaeda and training, advising, and assisting Afghan National Security Forces," the statement said.

NPR's Tom Bowman says that although most of the U.S. troops will be inside bases training Afghans, "Some U.S. troops will handle a counterterrorism mission, so they could be in harm's way, despite the president saying combat is over."

The Associated Press reports that:

"Newly appointed Afghan national security adviser Mohammad Hanif Atmar and U.S. Ambassador James Cunningham signed the agreement at the presidential palace in the capital, Kabul. A second agreement allowing NATO troops to stay in the country was also signed during the same ceremony."Government Chief Executive Abdullah Abdullah, who has assumed a post akin to prime minister after signing a power-sharing agreement with [Ghani], also welcomed the security deal."Copyright 2016 NPR. To see more, visit http://www.npr.org/.