Things are going to get worse in Afghanistan before they get better, U.S. President Barack Obama said Wednesday, but he remains optimistic his plan to start withdrawing U.S. forces from the war-torn country next year is still on track.

"What I've tried to emphasize is the fact that there is going to be some hard fighting over the next several months," Obama said at a news conference with Afghan President Hamid Karzai.

The two leaders met in Washington as U.S-led coalition forces are preparing for a major campaign in Kandahar province to begin in June, which is expected to be among the bloodiest of the entire war.

"There is no denying the progress," Obama said. "Nor, however, can we deny the very serious challenges still facing Afghanistan."

Both men put their best face on a relationship that has quite publicly become strained, both over the management of the war and Karzai's controversial re-election. Kazai drew a sharp rebuke from U.S. officials earlier this year when he threatened to join the Taliban, out of apparent frustration with what he believed was too much U.S. meddling in Afghan affairs.

"There has been a major deterioration in relations between Karzai and the Americans, not just over the past year, but even longer," Jamie Metzl of the Asia Society told CTV News Channel. "The Americans have wanted Karzai to do a much better job of promoting good governance and accountability in Afghanistan. And Karzai feels like he has been undermined by the Americans, who have been quite critical of him."

Karzai acknowledged the strain at the White House conference.

"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.

"The bottom line is, that we are much more strongly related to each other today than we ever were before."

Obama said there were setbacks in their relationship, but that tension between the two countries was 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," he said.

Metzl said that while the meeting between the two men is mostly about repairing their relationship, Karzai was expected to push for the United States' blessing in pursuing a plan to reach out to militants.

Obama seemed to allude that he did not agree with that tactic, saying he wanted further discussion on any political deal with the militants.

Despite the influx of tens of thousands of U.S. troops into Afghanistan in recent months, Obama pledged to begin pulling some soldiers out in July 2011.

The promise is designed to calm fears at home, as well as in Pakistan and Afghanistan, about how long the U.S. military mission will continue. But Obama is also signalling to Karzai that he expects his government to root out corruption and become a legitimate governing option for Afghans.

"We are not suddenly as of July 2011 finished with Afghanistan," Obama said. "After July 2011 we are still going to have an interest in making sure that Afghanistan is secure, that economic development is taking place, that good governance is being promoted."