President Obama plans to keep most of the 10,000 U.S. troops in Afghanistan in the country through 2015 -- and keep open two key airfields -- as part of an effort to slow the U.S. withdrawal and help prop up Afghan forces, sources told Fox News. 

Eager to avoid a repeat of Iraq, where Islamic State militants have filled a void left by U.S. forces, the Obama administration could announce the changes in the coming days as Afghan President Ashraf Ghani visits Washington, D.C., and meets with key leaders. 

Ghani has urged a slower drawdown, warning about the security environment in his country and even the emergence of ISIS-affiliated fighters. 

Under the new plan, most of the 10,000 U.S. soldiers in the country will remain through 2015, instead of trimming that force to 5,500 by the end of this year -- though troops would continue to rotate in and out of service in Afghanistan. Obama has said that after that, the U.S. would only maintain an embassy-based security force in Kabul of perhaps 1,000 troops. 

Second, sources say the U.S. will keep open the Kandahar Airfield in southern Afghanistan and Jalalabad Airfield in eastern Afghanistan through 2015, a reversal from prior plans. 

More On This...

The agreement could mark a new era of cooperation between the U.S. and Afghan governments, after years of tension under the Karzai government. 

Ghani, in an apparent effort to mend fences, on Monday thanked U.S. troops and taxpayers for their sacrifice and support during a Pentagon ceremony. 

"What I want to state on behalf of the Afghan people is that each one of you also has left a memory in the heart of every Afghan that you've touched and encountered," Ghani said in a message to American troops, honoring the more than 2,000 soldiers who "paid the ultimate sacrifice." 

Ghani also offered assurances that his country would not be a burden on the international community as it continues to struggle against the Taliban and its own internal divisions. Defense Secretary Ash Carter welcomed Ghani and Afghan Chief Executive Abdullah Abdullah at a ceremony in the Pentagon's center courtyard. 

Ghani thanked Obama and top administration officials, but also American taxpayers who "make your hard-earned dollars available for Afghanistan." 

His message was welcomed. "Karzai never did this. It's nice to be thanked," one Marine officer told Fox News. 

The Afghan president's tone was markedly different from that set by his predecessor, Hamid Karzai, who had a falling out with the U.S. government and left office amid an atmosphere of mutual distrust. 

Karzai did thank U.S. taxpayers during a speech in 2012, but by the time he left office his message had changed. In farewell remarks last year, Karzai accused the U.S. of not wanting peace, and thanked a slew of countries for their efforts in Afghanistan -- without thanking the U.S. 

At the time, the American ambassador to Afghanistan James Cunningham called the comments "ungracious and ungrateful." 

The Pentagon was a poignant setting for the start of Ghani's Washington visit. On Sept. 11, 2001, terrorists hijacked an American Airlines jetliner and flew it into the Pentagon, killing all aboard and 125 people in the building. The U.S. responded to the attacks on Washington and New York by invading Afghanistan a month later. 

Ghani and Abdullah Abdullah, on a weeklong trip to Washington, were headed later Monday to the Camp David presidential retreat in Maryland for closed door meetings with Carter and Secretary of State John Kerry. Later in the week Ghani is to meet with Obama at the White House and address a joint meeting of Congress. 

Carter praised Ghani as a committed leader who knows that "Afghanistan's future is ultimately for the Afghans to grab hold of and for Afghans to decide." 

Those themes emphasized by Carter and Ghani -- that Kabul's new leaders are more reliable and appreciative of U.S. assistance, and that the U.S. alone cannot solve Afghanistan's problems -- are central to the administration's approach to carrying out pledge to end the war. 

Obama has promised to remove the remaining U.S. troops from Afghanistan by the end of his presidency. But deficiencies in the Afghan security forces, heavy casualties in the ranks of the Afghan army and police, a fragile new government and fears that Islamic State fighters could gain a foothold in Afghanistan have combined to persuade Obama to slow the withdrawal. 

Ghani needs a firm commitment of American support in his fight against the Taliban and other insurgent groups, including an Islamic State affiliate, which he fears is finding a foothold in Afghanistan. With that in mind, Ghani proclaimed at the Pentagon ceremony Monday that the U.S. is supporting the winning side. 

"We die. But we will never be defeated," Ghani said. "Terrorism is a threat. It's evil. But we the people of Afghanistan are willing to speak truth to terror by saying no, you will never overwhelm us, you will never subdue us. We are going to overcome." 

"And in this endeavor our partnership with the United States is foundational because we will be the first line of defense for freedom globally," he added. 

Fox News' Lucas Tomlinson and The Associated Press contributed to this report.