TORONTO -- President Barack Obama said Sunday that there's "a lot of obsession" about the withdrawal date for U.S. troops from Afghanistan. He said his focus is on making sure the mission there is successful.

Obama's show of frustration about when he will end the unpopular war in Afghanistan came in his closing press conference at the G-20 summit in Toronto, where industrialized countries committed to slash their budget deficits in half by 2013. The president said the United States shares that commitment.

At the end of a week in which he dismissed his top commander in Afghanistan, Obama defended his war strategy and said the United States would assist the Afghans "for a long time to come."

"I don't have a crystal ball," the president said when asked about a five-year Afghanistan exit strategy endorsed Saturday by the Group of Eight major industrial democracies.

"I think that right now the debate surrounding Afghanistan is presented as either we get up and leave immediately because there's no chance at a positive outcome, or we stay basically indefinitely and do quote unquote whatever it takes for as long as it takes."

Obama's policy falls somewhere in the middle, thereby pleasing few. He reiterated that a July 2011 date to begin withdrawing troops does not mean the U.S. will "suddenly turn off the lights and let the door close behind us." Under Obama's policy, the number of U.S. troops in Afghanistan will first climb to 98,000.

Obama offered a rationale for the nation's very presence in Afghanistan.

"You'll often hear, why are we in Afghanistan when the terrorists are in Pakistan?" Obama said.

He contended America would be less secure if Al Qaeda still could be housed in Afghanistan, and contended there remains "a vital national interest that Afghanistan not be used as a base to launch terrorist attacks."

In Washington, CIA Director Leon Panetta expressed skepticism about whether insurgent groups in Afghanistan were interested in reconciliation with the U.S.-backed government in Kabul.

"We have seen no evidence that they are truly interested in reconciliation, where they would surrender their arms, where they would denounce Al Qaeda, where they would really try to become part of that society," Panetta said on ABC's "This Week."

Obama sounded more positive.

"I think that we have to view these efforts with skepticism, but also openness," the president said.

Obama also issued a warning to North Korea, saying its alleged sinking of a South Korean warship was "belligerent behavior that is unacceptable" to the international community. Forty-six South Korean sailors died in the March incident.

"It is absolutely critical for the international community to rally behind" South Korean President Lee Myung-bak, Obama said.

Obama told reporters bluntly that he hoped Chinese President Hu Jintao would recognize that North Korea crossed a line in the warship sinking.

"There's a difference between restraint and willful blindness to consistent problems," Obama said, referring to Beijing's worry that instability in the North could cause major problems across the border in China.

Obama said he wants the U.N. Security Council to produce a "crystal-clear acknowledgment" of the North's action. The cooperation of China, a veto-wielding member of the Security Council and North Korea's major international supporter, is crucial to that goal.

Obama said shying away from the harsh facts about North Korea's behavior is "a bad habit we need to break."

He also emphasized the importance of China carrying through on its pledge to introduce more flexibility in how it manages its currency, the yuan.

"A strong and durable recovery also requires countries not having an undue advantage," he said. "As I told (Chinese) President Hu Jintao yesterday, the United States welcomes China's decision to allow its currency to appreciate in response to market forces. We will be watching very closely in the months ahead."

The G-20's final summit communique did not mention China's currency directly, only generally expressing a need for countries to have flexible currency exchange rates. It did not take China to task for its managed currency policies, which American manufacturers blame for the loss of millions of jobs because they keep the cost of China-made products artificially low.

Asked about the timing for China to increase the yuan's value, Obama said that as more market forces come to bear, he believed the Chinese currency "is going to go up significantly."

Obama was asked about the prospects of his Supreme Court nominee Elena Kagan, whose confirmation hearings begin Monday before the Senate Judiciary Committee. He said his former Senate colleagues "should pay attention to Elena Kagan's record and her testimony ... and then vote their conscience."

He called objections to Kagan raised by Republicans "pretty thin gruel."