Trying to repair relations with the U.S., Afghan President Ashraf Ghani told Congress on Wednesday that his country owes a "profound debt" to the more than 2,200 American soldiers killed in Afghanistan.

In a speech to a joint meeting of Congress, Ghani also thanked the U.S. for development aid and other civilian assistance. And he promised he will be a good steward of continued U.S. assistance to his country as it works to rebuild while struggling against a stubborn insurgency.

"We owe a profound debt to the soldiers who have lost limbs to buried bombs, to the brave veterans, and to the families who tragically lost their loved ones to the enemy's cowardly acts of terror," Ghani said.

"We owe a profound debt to the many Americans who have come to build schools, repair wells, and cure the sick. And we must acknowledge with appreciation that at the end of the day it is the ordinary Americans whose hard-earned taxes have over the years built the partnership that has led to our conversation today."

Hours before Ghani spoke, at least six people were killed and more than 30 were wounded in a suicide car bombing near the presidential palace in Kabul.

Ghani is untested as a leader, yet he received a warm reception from both Republicans and Democrats on Capitol Hill. The reason: He's not former Afghan President Hamid Karzai.

Lawmakers have been critical about U.S. troop involvement in America's longest war, wasteful spending in Afghanistan and Karzai's anti-American rhetoric.

Toward the end of his tenure, Karzai did not think the U.S. was holding Afghanistan's interests front and center. He repeatedly railed against the thousands of civilians being killed and said the war against terrorists should not be fought in the villages of his country. U.S. officials and lawmakers did not think Karzai's comments were appropriate given that 2,200 U.S. servicemen and women had been killed and billions of U.S. tax dollars had been spent during the conflict.

Still, despite being weary of war, lawmakers from both parties praised the White House announcement Tuesday to slow the pace of the U.S. troop withdrawal.

In a shift from his previous plan, Obama said the U.S. would leave its 9,800 troops in Afghanistan in place rather than downsizing to 5,500 by year's end. The size of the U.S. footprint for next year is still to be decided, Obama said, but he brushed aside any speculation the withdrawal will bleed into 2017. That means the slowdown won't jeopardize his commitment to end America's involvement in Afghanistan before leaving office.

Deficiencies in the Afghan security forces, heavy casualties in the ranks of the army and police, a fragile new government and fears that Islamic State fighters could gain a foothold in Afghanistan combined to persuade Obama to slow the withdrawal.

Ghani also told the lawmakers packed into the House chamber that IS militants pose a "clear and present danger" to Afghanistan and other states in western and central Asia.

"Terrorist movements whose goal is to de-stabilize every state in the region are looking for new bases of operation," he said. "We are the frontline, but the terrorists neither recognize boundaries nor require passports to spread their messages of hate and discord."

"From the west, the IS militants are sending advance guards to southern and western Afghanistan. To the south, Pakistan's counter-insurgency operations ... are pushing the Taliban from south Waziristan (in Pakistan) towards Afghanistan's border regions," Ghani said.

And he challenged leaders, intellectuals and the millions of Muslims who believe that Islam is a religion of tolerance and virtue to speak out against Islamic extremism.

"Silence is not acceptable,'" he said.

On a lighter note, Ghani drew laughter when he talked about his time living in New York. "I ate corned beef at Katz's, New York's greatest, greasiest, pickle-lined melting pot," he said.

Ghani's speech contrasted with the one received by Israeli Prime Minister Benjamin Netanyahu, who spoke to lawmakers earlier this month. Some Democrats skipped his speech, in which he warned the U.S. that an emerging international agreement the U.S. was trying to reach with Tehran would pave Iran's path to developing nuclear weapons.