U.S. Defense Secretary Leon Panetta wrapped up a short visit to India this week, calling for Washington and New Delhi to deepen security ties and defense cooperation in the region. As NATO-led troops get ready to leave Afghanistan and the Obama Administration continues its effort to counterbalance China’s growing military heft, Panetta’s goal was to shore up India’s support in the region during his meetings with Prime Minister Manmohan Singh and Defense Minister A.K. Antony, among others.

In a speech on Wednesday at the Institute for Defence Studies and Analyses, an Indian defense think tank, Panetta urged India to help Afghanistan during and after NATO’s exit by supporting its neighbor through trade and investment, reconstruction and help for Afghan security forces. “We both realize how important it is to ultimately have a stable Afghanistan if we are to have peace and prosperity in this region,” he said. To achieve that, Panetta said both India and the U.S. “will need to continue to engage Pakistan, overcoming our respective and often deep differences.” He applauded India’s recent progress in boosting trade ties with its neighbor as being key to “helping Pakistan turn around its economy and counter extremism within its borders.”

The U.S. also wants India’s cooperation with its military “pivot to Asia,” in which it is looking to develop allied military forces in the region through increased arms trade and joint-miltiary exercises to work in conjunction with a lighter and more agile U.S. troop presence. Though the U.S. never explicitly says so, the move is designed to better coordinate the U.S. and its allies to counter China’s increasingly aggressive expansion in the region, where countries from Japan to the Philippines to Vietnam have locked horns with Chinese ships over disputed territories in the past two years. “Our vision is a peaceful Indian Ocean region supported by growing Indian capabilities … The fundamental challenge is to develop India’s capabilities so it can respond to challenges,” Panetta said in the speech.

India’s response to Panetta’s propositions was measured, though it is certainly interested in U.S. military technology. That’s partly because New Delhi doesn’t want to upset China by showing overt enthusiasm for Washington’s new Asia strategy, despite the fact that it too has tangled with its neighbor in the South China Sea. (It probably irked U.S. officials that the Indian press made no attempt to hide its pleasure with the fact that India came out looking like the belle of the ball on Wednesday when, as Panetta made his speech in Delhi, Chinese Vice Premier Li Keqiang reportedly pulled Indian External Affairs Minister S.M. Krishna aside at a Shanghai Cooperation Organization summit to say China and India was the real relationship of the century.)

It’s also partly because while the American and Indian governments share fundamental policy values about democracy, nonproliferation and anxiety over an increasingly muscular China, the U.S. has a tendency to rub Indian politicians the wrong way. “The U.S. doesn’t understand friendships,” says Mohan Guruswamy, the founder of the Centre for Policy Alternatives, a nonpartisan New Delhi-based think tank. “The U.S. understands alliances in which it’s the top dog.”

As far as Afghanistan goes, India does have a keen interest in the country, both to ensure Pakistan does not gain an upper hand after NATO’s withdrawal and to tap into the nation’s vast natural resources before China gets them all first. But access to Afghanistan’s minerals has little to do with the U.S. In fact, until relations with Pakistan warm up enough to reopen overland trade routes (and that won’t be anytime soon), India’s hopes to develop Afghan mines are wholly contingent on transit through Iran, one of the key reasons why India was not the first nation to jump on Washington’s Iran oil sanctions.

On the security side, beyond continuing its agreement to train Afghan security forces in India, New Delhi is uninterested in getting involved in the country militarily, and Panetta was quick to put speculation to rest that he asked Singh and Antony to do so. “I urged that they continue to [train forces], if possible, expand their training in order to prove the efficiency of the Afghan army,” he told reporters. “There was nothing said about doing anything in terms of additional military efforts in Afghanistan itself.”

As its relations with Pakistan get steadily worse, the U.S. needs all the help it can get in the region. On Thursday, Panetta arrived in Kabul amid rising violence and close on the heels of a deadly NATO air strike that killed as many as 18 villagers. He immediately lashed out at Pakistan in some of the strongest language that a high-level U.S. official has used regarding its problematic ally: “It is difficult to achieve peace in Afghanistan as long as there is safe haven for terrorists in Pakistan,” he said. Referring specifically to Pakistan’s alleged harboring of members of the Haqqani militant network, he said: “It is an increasing concern that safe havens exist [in Pakistan] and those like the Haqqanis make use of that to attack our forces … We are reaching the limits of our patience.”

Islamabad has refused to reopen key NATO supply routes into Afghanistan as the U.S. continues its campaign of drone strikes targeting militants on Pakistan’s soil. The U.S. said strikes this week killed al-Qaeda’s second in command — Abu Yahya al-Libi.