"There is no denying the progress," Obama said. "Nor, however, can we deny the very serious challenges still facing Afghanistan."
Karzai's warm White House welcome followed months of sniping and frustration over management of the war and about fraud allegations surrounding Karzai's re-election last year.
"There are moments when we speak frankly to each other, and that frankness will only contribute to the strength of the relationship," Karzai said with a smile.
Obama acknowledged "setbacks" in the U.S. relationship with Afghanistan, but both he and Karzai said worries about the future of the partnership have been exaggerated.
"Obviously there are going to be tensions in such a complicated and difficult environment and in a situation in which on the ground both Afghans and Americans are making enormous sacrifices," Obama said. Karzai said disagreements are normal in the grinding war.
Obama said he was confident he will be ale to meet his goal of beginning to withdraw U.S. forces in July 2011, with Afghan security forces beginning to take over the fight.
U.S. relations with Afghanistan have been under deep strain, and Wednesday's meeting at the White House was intended to help repair ties. The U.S. has criticized Karzai for tolerating corruption and drug trafficking, while Karzai has accused Washington of failing to give him the support he needs to govern.
Obama says there have been steady signs of progress since he increased the number of U.S. forces in Afghanistan late last year. But he said progress takes time and cautioned that the U.S. must commit to a long-term partnership with Afghanistan.
The war isn't confined within Afghanistan's borders, Obama said.
Questioned by an Afghan reporter, he said he sees a growing recognition among leaders in neighboring Pakistan that the extremist groups who are based there represent a "cancer in their midst." He said Pakistani leaders are recognizing that the groups that are using Pakistan's frontier as a base are threatening the nation's sovereignty.
It will take time for Pakistan to assert control in border areas that have been "loosely governed," he said. Pakistani authorities are starting to do that, but it's "not going to happen overnight," the president said.
He said U.S. and Afghan officials have been emphasizing to Pakistani leaders that the security of all three countries is "intertwined."
Obama said the United States' main goal in Afghanistan remains to defeat the al-Qaida terror network and prevent it from again taking hold in the country from which the Sept. 11 attacks were planned. Karzai thanked Obama for expanding the war against insurgents trying to push him from power.
The two leaders pledged cooperation and respect after a turbulent period, although Obama alluded to at least one area where the two men may not agree. He said he looks forward to further discussion about how Karzai's government will reach out to militants for a possible political deal to end the war. Karzai wants America's blessing for faster outreach to militant leaders.
On the eve of a major military push into the Taliban home ground of Kandahar province, Obama said, "We are steadily making progress." He asserted that the U.S.-led forces in Afghanistan are beginning to "reverse the Taliban's momentum."