Updated

President Obama announced Tuesday that the U.S. will keep nearly 10,000 troops in Afghanistan through the end of the year, hitting pause on the scheduled drawdown after Afghan President Ashraf Ghani voiced security concerns.

The president, saying Afghanistan remains a "dangerous place," announced the move in a joint press conference with Ghani. The two met earlier in the Oval Office, during Ghani's first White House visit since being elected president of the war-torn country.

Obama stressed that his goal of finishing the drawdown by the end of his term has not changed, but said hitting pause this year is "well worth it," as the spring fighting season approaches.

"This flexibility reflects our reinvigorated partnership with Afghanistan," Obama said, standing next to Ghani.

The change also reflects a desire -- by both Kabul and Washington -- for Afghanistan not to go the way of Iraq, where the void left by U.S. troops was filled by Islamic State fighters. In Afghanistan, while there is an ISIS-affiliated presence, the Taliban still pose the biggest threat.

More On This...

    Obama acknowledged he wants to make sure Afghan forces are prepared to handle security "so we don't have to go back."

    The original U.S. military plan was to bring the U.S. force down to 5,500 by the end of the year. Under the new plan, detailed in a White House statement and announced by Obama during the press conference, the current force of 9,800 troops will remain through the end of 2015. Ghani had sought the more robust U.S. troop presence.

    Obama stressed that the "specific trajectory" of the drawdown for 2016 will be established later this year -- and he still wants to stick to the plan of reducing the force to a "Kabul-based embassy presence" by the time he leaves office. "That hasn't changed," Obama said on Tuesday.

    The pace of the U.S. troop drawdown was the  focus of daylong White House meetings, and the centerpiece of Ghani's highly anticipated visit to the U.S. On the job only six months, Ghani is trying to make the case that he's a reliable partner worthy of American support, despite his fractured government and a litany of problems still rampant in Afghanistan's military -- illiteracy, drug abuse and desertions, to name a few.

    Ghani arrived midmorning at the White House, where a U.S. military honor guard lined the driveway leading to the West Wing. Inside, he and Obama chatted casually and sat side by side as reporters were allowed briefly to observe the start of their meeting.

    For Obama, Ghani represents the last, best hope to make good on the president's promise to end America's longest war by the time he leaves office, keeping just a thousand or so troops at the embassy to coordinate security. Ghani predecessor Hamid Karzai's relationship with the White House was increasingly dysfunctional, and if the dealings with Ghani don't turn out better, Obama risks leaving Afghanistan still vulnerable to the kinds of violent extremist groups that operated with impunity until 14 years ago, when the U.S. attacked after 9/11.

    Ghani's government asked the president to keep more U.S. troops in his country for longer, as Afghan forces brace for a tough spring fighting season and contend with Islamic State fighters looking to recruit on their soil.

    Also at stake: the future of U.S. bases in Jalalabad and in Kandahar, where the Taliban had their capital until 2001. U.S. military leaders have seemed receptive to Ghani's request that those bases stay open as long as possible -- sources tell Fox News the Obama administration plans to keep the bases open through this year.

    "It's very important," Ghani said of the pause in US troop withdrawal Tuesday afternoon on "Special Report with Bret Baier." "I'm greatly appreciative of the decision President Obama made today."

    Further underscoring the fragile security situation, gunmen killed at least 13 people overnight during a midnight assault on a highway near Taliban-held territory in eastern Afghanistan, although no group immediately claimed responsibility.

    The Associated Press contributed to this report.