WASHINGTON — President Obama, declaring that it was “time to turn the page on a decade in which so much of our foreign policy was focused on the wars in Afghanistan and Iraq,” announced on Tuesday that he planned to withdraw the last American troops from Afghanistan by the end of 2016.

Under a new timetable outlined by Mr. Obama in the Rose Garden, the 32,000 American troops now in Afghanistan would be reduced to 9,800 after this year.

That number would be cut in half by the end of 2015, and by the end of 2016, there would be only a vestigial force to protect the embassy in Kabul and to help the Afghans with military purchases and other security matters. At the height of American involvement, in 2011, the United States had 101,000 troops in the country.

Mr. Obama said the withdrawal of combat troops from Afghanistan would free up resources to confront an emerging terrorist threat stretching from the Middle East to Africa — a strategy he plans to detail in a commencement address on Wednesday at the United States Military Academy in West Point, N.Y.