President Barack Obama announced Tuesday that the U.S. will slow its military withdrawal from Afghanistan, maintaining 9,800 troops in the country through the end of 2015 instead of cutting the number by about half as originally planned.

"Afghanistan remains a very dangerous place," Obama said in explaining his decision at a press conference after Afghan President Ashraf Ghani's first visit to the White House since his election six months ago. Obama added that the size of the U.S. troop presence for 2016 will be decided later this year.

Ghani had asked Obama to slow the withdrawal because Afghan security forces are bracing for a tough spring fighting season and are also contending with Islamic State fighters looking to recruit on their soil.

The original plan was to cut the U.S. force to 5,500 by the end of this year.

"This visit is an opportunity to begin a new chapter between our two nations," Obama said after meeting with Ghani in the Oval Office.

Ghani was 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 at 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.

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.

Drawing a contrast with his predecessor, Ghani has taken pains on his U.S. visit to display gratitude for U.S. sacrifices in Afghanistan that the White House found lacking from Karzai. He began his trip by explicitly thanking the U.S. for its support. And on Tuesday morning, Ghani joined Defense Secretary Ash Carter and Vice President Joe Biden in laying a wreath at the Tomb of the Unknowns at Arlington National Cemetery.

"We do not now ask what the United States can do for us," Ghani said, invoking John F. Kennedy as he opened his U.S. visit earlier in the week. "We want to say what Afghanistan will do for itself and for the world."

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. And elsewhere in Afghanistan, a suspected U.S. drone strike near the border with Pakistan killed at least nine militants from a Pakistani terror group, intelligence officials in Pakistan said.

Ghani, who lived in the U.S. for more than a decade, has been a welcome change for the Obama administration. Frustration with his predecessor reached a boiling point when Karzai refused to sign the security agreements needed for the U.S. to leave troops in Afghanistan. Ghani signed them within days of taking office, and has sought to differentiate himself by showing appreciation for U.S. investment in his military — more than $60 billion so far.

After hotly contested election results, Ghani and chief rival Abdullah Abdullah agreed to share power, with Abdullah assuming the new role of chief executive. They made the trip to the U.S. together in a show of unity.

Yet political tensions have prevented the leaders from even putting together a full cabinet, half a year into their term.

Imbuing the visit with added anxiety is a new, home-grown affiliate of the Islamic State group, whose flagship branch in Iraq and Syria is another menace to Obama's legacy on foreign policy. It's not fully clear how strong or widespread the offshoot's presence is in Afghanistan.

___

Associated Press writers Robert Burns in Washington and Amir Shah in Kabul, Afghanistan, contributed to this report.

___

Reach Josh Lederman on Twitter at http://twitter.com/joshledermanAP