Afghan President Ashraf Ghani came to Washington this week to ask President Obama to slow the pace of withdrawal of U.S. troops in his country. Now, with Obama on board, Ghani delivered a long thank-you note to Congress—and a promise to not "saddle" the U.S. with Afghanistan's baggage.

"The people of Afghanistan recognize the bravery of your soldiers and the tremendous sacrifices that Americans have made to keep Afghanistan free," Ghani told a joint session of Congress on Wednesday. "We owe a profound debt to the 2,350 service men and women killed and the more than 20,000 who have been wounded in service to your country and ours. We owe a profound debt to the soldiers who've lost limbs, to the brave veterans, and to the families who tragically lost their loved ones to the enemy's cowardly acts of terror."

Ghani thanked the U.S. profusely in his remarks. The grateful tone stands in stark contrast to comments by his predecessor, Hamid Karzai, with whom the Obama administration had a turbulent relationship. About this time last year, Karzai and Obama were not on speaking terms, and the former Afghan president was saying that he "saw no good" in the U.S. presence in his country.

Ghani, in his speech Wednesday—after running through a list of thank-yous to senators, ambassadors, military generals and "the American taxpayer"—turned to the state of Afghanistan. The country's story, he said, is about "how a poor country that relied on foreign help became a self-reliant nation where free trade and the rule of law create jobs and prosperity for its people. It is also a story about how a country that has been ravaged became a platform for peace and regional stability and prosperity."

Recounting his experience of the terrorist attacks of September 11, 2001, Ghani, who graduated from Columbia University and whose children were born in New York, said the attacks were "personal" for him.

"I was in my office at the World Bank when the first plane crashed into the World Trade Center and forever changed the lives of each and every one of us," he said. "I visited Ground Zero that very week. Seeing firsthand the tragedy and devastation drove home the realization that after 9/11 the world would never be the same."

Ghani also addressed modern-day terrorism threats, including Islamic "extremists" such as the Islamic State.

"To date, Afghanistan's people have rejected the violent movement. We are willing to speak truth to terror," he said, to a standing ovation from Congress.

Like Obama, Ghani did not label the Islamic State as "radical Islam." "We, the unity government of Afghanistan, know that Islam is a religion of peace," he said.

The Afghan president vowed to support women's rights in his country, one of the worst places to be a woman.

"A mental and cultural revolution must take place over treatment of women and by our society," Ghani said. "There's no point talking about how much we respect women's honor if we let threats go unpunished or allow harassment in our street."

As for women in Afghanistan politics, Ghani said that he is "meeting frequently women who are entertaining seriously the idea of becoming the first woman president of Afghanistan, and we will support them."

In closing his speech, Ghani said that his country will not depend on the U.S. forever.

"We don't want your charity," he said. "We have no more interest in perpetuating a childish dependence than you have in being saddled with a poor family member who lacks the energy and drive to get out and find a job. We are not going to be the lazy Uncle Joe."

Ghani also reaffirmed his government's goal to defeat terrorists in Afghanistan, a mission currently aided by U.S. troops on the ground. "Your support, your understanding, and your commitment to our country will not have been in vain," he said. "Afghanistan will be the graveyard of al-Qaida and their foreign terrorist associates."

Ghani's address came just one day after the Obama administration announced that it would delay the planned withdrawal of U.S. troops from Afghanistan, despite a pledge to reduce the number by the end of this year. The new plan keeps the 9,800 troops currently stationed in the country through 2015. Ghani had requested that the administration slow the pace of withdrawal,saying that Afghan citizens see the U.S. as "critical to their future."

"This flexibility reflects our reinvigorated partnership with Afghanistan, which is aimed at making Afghanistan secure and preventing it from being used to launch terrorist attacks," Obama said in a joint press briefing at the White House Tuesday. "Reconciliation and a political settlement remain the surest way to achieve the full drawdown of U.S. and foreign troops from Afghanistan in a way that safeguards international interests and peace in Afghanistan, as well as U.S. national security interests."

Unlike the last foreign leader to address Congress—Israeli Prime Minister Benjamin Netanyahu—Ghani received a warm welcome from both parties, garnering several standing ovations. Per the Associated Press, Republican Sen. Bob Corker of Tennessee, the chairman of the Senate Foreign Relations Committee, called Obama's announcement the "right decision," and Rep. Adam Schiff of California, the ranking Democrat on the House Permanent Select Committee on Intelligence, said that American troops in Afghanistan are crucial to the U.S. mission against the Islamic State.

Ghani's visit to the U.S., his first as president, offered an opportunity to revive the relationship between the countries. At Tuesday's joint appearance, Obama lauded America's "reinvigorated partnership with Afghanistan," while Ghani expressed gratitude to the American people: "You stood shoulder to shoulder with us, and I'd like to say thank you."