Afghanistan and the United States have signed a long-awaited security pact that will allow U.S. forces to remain in the country past the end of year.

At a Tuesday ceremony in the capital, Kabul, newly appointed national security adviser Mohmmad Hanif Atmar signed the document along with U.S. Ambassador James Cunningham.

President Ashraf Ghani Ahmadzai, who was sworn into office a day earlier, told the assembled crowd that the agreement signaled a fundamental shift in the country's relations with the world.

"This agreement is only for Afghan security and stability," he said.