Pakistani leader Gen Pervez Musharraf is concluding an extensive tour of the Americas and Europe in circumstances vastly different from his first official visit to a Western nation about five years ago.
Musharraf - boosted at home by praise from President Bush
Then, Western governments widely saw him as a military dictator following his 1999 coup - his ideological and political moorings were deemed suspect.
Now, he is seen more as a constitutional president who is a trusted ally and a close personal friend of many Western leaders.
The transition has been anything but smooth, especially in the context of US-Pakistan relations.
From concerted attacks against US installations and Western citizens based in Pakistan to nuclear proliferation concerns to deep-rooted suspicions between intelligence officials of the two countries, the evolution in Gen Musharraf's status has weathered many storms.
'Out of control'
Many observers feel the only thing that has carried this relationship through is the Musharraf government's success in containing what was a developing relationship between militant sectarian outfits operating out of Pakistan and senior figures within al-Qaeda.
"There was a time when the situation could have spiralled out of control," a senior police official deeply involved in anti-terror investigations told BBC News.
Gen Musharraf's role in the US-led war on terror was the only area that earned him unqualified praise from President Bush during his recent visit to Washington
"We were shocked at the lateral as well as vertical spread of Pakistani terrorist outfits."
According to these officials, Pakistani authorities had little knowledge of the links that Pakistan's sectarian organisations such as Lashkar-e-Jhangvi had established with al-Qaeda members slipping down from Afghanistan until the kidnapping and murder of Wall Street Journal reporter Daniel Pearl.
The extent and nature of these links came to light during investigations into Pearl's killing.
Officials say that soon after Pearl's death, Pakistani authorities found themselves confronted with a spectre of an alliance between al-Qaeda and local sectarian organisations.
"Had their links matured and prospered, it would have taken the war on terror into the country's streets and back alleys, making it impossible for the government to control the situation," says a senior government official.
Aided by state-of-the-art counter-espionage technology provided by the United States, Pakistani authorities started to focus on killing or capturing sectarian militants.
Pearl's killing brought attention to Pakistan's al-Qaeda problem
This has been regarded by Washington as "a local issue" in which the US was extremely reluctant to get directly involved.
Over the past year, key militants in almost every sectarian organisation have either been killed or driven out of action.
During the same period, bombings by militants have claimed more than 200 civilian lives.
President Musharraf himself was lucky to survive two assassination attempts within the space of a fortnight last year.
In contrast, Pakistan's drive against militants from Afghanistan filtering into the border belt of Waziristan has been somewhat less successful.
According to figures provided by Corps Commander Peshawar, Lt-Gen Safdar Hussain, in 35 military operations up to October this year, Pakistani military and paramilitary forces had killed 250 militants in Waziristan.
Nearly 600 have been captured. About 100 "hardcore militants" are still said to be hiding out in Waziristan.
Pakistani forces have lost 175 men in the process, making these the heaviest military losses for Pakistan since the brief conflict with Indian forces in Kargil five years ago.
That was perhaps why Gen Musharraf's role in the US-led war on terror was the only area that earned him unqualified praise from President George W Bush during a recent visit to Washington.
Protesters in London during Musharraf's tour
While he failed to win concessions over any of the other issues raised in his meeting with Mr Bush - textile export quotas to the US, a refund of $4bn paid for F-16s over 10 years ago and third-party mediation in Kashmir - Gen Musharraf will not be complaining.
Praise from a powerful ally, even if limited to one area of a fairly wide-ranging relationship, was enough for many analysts in Pakistan to bill Gen Musharraf's US visit a success.
The Karachi stock market rose more than 100 points in three days in the wake of Mr Bush's laudatory remarks.
More importantly, it sent a powerful signal to Gen Musharraf's opposition of the support that he still enjoys from one of the three pillars that are said to prop Pakistani politics - Allah, Army and America.
Observers are convinced that it is enough to blunt the opposition's plans to generate protests against Gen Musharraf's dual role as president and army chief.
The general's opponents, it seems, now have no option but to concede that their adversary has returned from the US as a powerful military leader who will remain in control despite what it may mean for the future of democracy in Pakistan.