When Secretary of State Hillary Rodham Clinton visited Indonesia earlier this year, she said: "If you want to know whether Islam, democracy, modernity, and women's rights can coexist, go to Indonesia."

When she visited Pakistan recently, she was polite but much more critical in her words, basically accusing some government officials of sheltering Taliban and Al Qaeda terrorists.

Indonesia and Pakistan, two non-Arab states, account for a quarter of the world's 1.6 billion Muslims. If democracy flourishes there, it could influence democracy's progress in other Muslim, but Arab, lands. American diplomacy toward Indonesia is quite different from its approach to Pakistan.

In the case of Indonesia, the tenor is dictated more by Indonesia than by the United States. In the era of Sukarno, the nation's first president after independence from the Dutch, Indonesia moved far to the left and cozied up to Communist China. An abortive coup, and a horrifying purge that took at least 200,000 lives, left the Indonesian Communist Party decimated and a searing memory upon the nation's psyche. Indonesia moved back to the political center, and amity with the West, but was determined not to be anyone's pawn.

US administrations have been astute in understanding this and maintaining discreet relationships with successive Indonesian regimes. One noteworthy humanitarian move took place in 2005 when the US mounted a major relief effort after the Asian tsunami. About 15,000 US service personnel, operating from the carrier Abraham Lincoln, supported heli­copter flights carrying food, water, and other aid to the victims.

After Sukarno, Indonesia had a disappointing three-decade rule by General Suharto, during which the Army remained vigilant and influential. But free elections have helped Indonesian politics blossom in recent years. This year, popular President Susilo Bambang Yudhoyono was reelected.

Indonesia has effected this transformation by itself and has similarly pursued Islamist extremists who killed more than 200 people in the Bali bombing in 2002, and bombed Jakarta this year. Despite these events, Indonesia has been able to maintain its commitment to a more moderate version of Islam.

By contrast, US diplomacy toward Pakistan has been more robust and intrusive. Different administrations have played politics with a series of Pakistani leaders as that country has drifted in and out of military rule with periods of unsettled democracy.

The US will soon have a permanent icon of its involvement with a fortified new embassy said to contain more than 1,500 personnel on 18 acres of land in Islamabad.

Understandably the US has more at stake, and a more complex relationship, with Pakistan than it does with Indonesia.

Pakistan has nuclear weapons; lives in a terrorist-laden region; is suspicious of India on one border and of a mélange of government-defying tribes straddled across another, ill-defined border. The Pakistani government bridles at US drones hunting across its border for Al Qaeda and Taliban extremists. It must bristle sometimes at its lack of control over its own military intelligence service cutting deals with unknown groups. It wants billions of aid from America but feels humiliated by US demands that there be oversight of how it is spent.

Secretary Clinton says trust must be two-way, but US diplomacy and presence have been hot and cold with Pakistan over the years. All this may be challenging for Pakistanis, now themselves engaged in a war against extremism. But for America, recently discovering new plots at home by would-be terrorists trained in Pakistan, the consequences of new attacks on the homeland originating from Pakistan could be dire.

US diplomacy must sometimes be delicate and deft, as it is with Indonesia. It must sometimes nudge, as it is doing in Pakistan.

The immediate effect of nudging must be progress in the campaign against terrorism. The bigger picture must be the process to strengthen Pakistan's democratic structure and self-sufficiency, making it an example to the rest of the Muslim world.

John Hughes, a former editor of the Monitor, writes a biweekly column for the Monitor's weekly print edition.