Defense Secretary Robert M. Gates leaned on India and Pakistan during his trip to South Asia this week to set aside a simmering rivalry and confront militant extremists. At the same time, Gates and other U.S. officials pushed arms sales that could fuel the antagonism between the two countries.

Gates’ trip was framed by that apparent contradiction in U.S. policy. On his arrival in Pakistan, a television news interviewer put the question bluntly: “Why re-arm both countries?” The Pentagon chief sidestepped the question.

But Gates and other officials explained afterward that Washington hopes the military cooperation will help the U.S. win the trust it needs to advance its goals in the region. And, besides, they said, the two countries could get weapons elsewhere, so why not from us?

“I think we have to make these decisions judiciously,” Gates said. “But we also do not simply want to turn over these military relationships to other countries who don’t have as many scruples as we do in terms of making these decisions.”

The U.S. has increased annual military aid to Pakistan to about $3 billion a year and taken on controversial projects, such as helping to refurbish and expand Islamabad’s fleet of F-16 fighter jets.

Gates said Thursday that the U.S. also would provide surveillance drones to the Pakistani military, acceding to a long-standing request.

Two days earlier, Gates praised an expanding arms trade with India, saying that U.S. weapons would give New Delhi “the best products in the world.”

India is also weighing major aircraft purchases, including billions of dollars worth of fighter jets.

Expanding the conventional military power of two sometimes bitter adversaries may not seem like the best strategy for distracting the nations from their rivalry. But U.S. officials see signs that both countries may be starting to trust Washington’s counsel.

After the 2008 terrorist attack in Mumbai, India took U.S. advice against ratcheting up tensions with Pakistan, despite its impatience with the response to the Pakistani-based militant group believed responsible for the strike.

Pakistan, for its part, has taken action against militant groups in its tribal areas. It has 140,000 troops on its western border who have been engaged in a sustained assault on Taliban and Al Qaeda hide-outs since late April.

Military officials said the Pentagon was being careful to not alter the balance of power in South Asia, even when providing F-16s to Pakistan.

“Another squadron of F-16s means they [Pakistan] will lose the next war with India a little slower,” said a U.S. military official in Islamabad, speaking of the arms sales on condition of anonymity. “They are not going to defeat India because we gave them a squadron of F-16s. The military overmatch India enjoys is just too great.”

Washington is sensitive to the risk of dramatically increasing one country’s military prowess beyond the other’s, which would change the calculus and potentially trigger the very war the United States wants to avert.

For example, the United States wants Pakistan to expand its surveillance capability, but it does not want to deliver long-range or heavily armed drones that Pakistani engineers could re-engineer into a platform for nuclear weapons.

Similarly, India covets high-tech fighters, but the United States does not want to offer it stealth jets that could penetrate Pakistani airspace without challenge.

Nonetheless, the technology and logistics agreements that go along with an expanded defense trade will bind the United States and India closer together, officials said.

Likewise, officials believe that providing Pakistan with weapons -- even those not specifically intended for counter-insurgency operations -- is crucial to Washington’s larger goal of countering Pakistani distrust.

“How do we close the trust deficit? By acting like friends,” the official said. “By being willing to do things to meet their perceived needs, even if it does nothing for us.”

julian.barnes@latimes.com