President Barack Obama said Pakistan is "hedging its bets" by maintaining ties to militant groups that trying to undermine the government in neighboring Afghanistan, and acknowledged Thursday that the United States has been unable to persuade Pakistan that the U.S. goals of a stable Afghanistan poses no threat to Pakistan.

Obama did not echo the harsh assessment of his former chief military adviser that Pakistan has directly contributed to a militant attack on the U.S. embassy in Kabul.

Obama said the U.S. would "constantly evaluate" its relationship with Pakistan to see whether it was advancing American interests. Having given Pakistan more than $20 billion in aid since 9/11, Americans are increasingly questioning the value of assistance that has yet to yield a more willing partner in the fight against Islamic extremist groups fighting U.S. troops in Afghanistan.

"I think that they have hedged their bets, in terms of what Afghanistan would look like. And part of hedging their bets is having interactions with some of the unsavory characters who they think might end up regaining power in Afghanistan after coalition forces have left," Obama said.

A few days before leaving his job last month, Joint Chiefs of Staff Chairman Adm. Mike Mullen called the Taliban-affiliated Haqqani insurgent network a "veritable arm" of the Pakistani intelligence agency, and alleged direct support for the militants who had mounted a 20-hour rocket attack on the U.S. embassy in Kabul the week before.

The United States wants to "transition out of Afghanistan and leave a stable government behind _ one that is independent, one that is respectful of human rights, one that is democratic," Obama told a news conference, a reference to the plan to withdraw U.S. and other international forces by 2015. But he added: "Pakistan, I think, has been more ambivalent about some of our goals there."

The president's assessment in many ways reflected long-standing U.S. concerns over perceived Pakistani duplicity in the fight against terrorists and Taliban-linked insurgents. After more than a decade of inconsistent counterterrorism cooperation, and the revelation that Osama bin Laden was living unmolested in a military town near Islamabad, Washington's suspicions have only grown deeper.

"There is no doubt that there's some connections that the Pakistani military and intelligence services have with certain individuals that we find troublesome," Obama said

He said the U.S. was trying to bring the two neighbors closer together, "but we've still got more work to do."

While the U.S. has suspended some military assistance to Pakistan, Obama rejected the idea that the U.S. would withhold humanitarian aid for disasters such as floods "because of poor decisions by their intelligence services."

He conceded that Americans are "not going to feel comfortable with a long-term strategic relationship with Pakistan if we don't think that they're mindful of our interests as well," but stressed that his administration has made great strides in its No. 1 job in Pakistan: fighting al-Qaida.

In elaborating his argument, he avoided any mention of the U.S. operation that killed bin Laden in May, and the Pakistani anger it has prompted, saying only that American successes in the border region between Pakistan and Afghanistan could not have been possible without Pakistani support.

"On a whole range of issues, they have been an effective partner with us," Obama noted.