Last Saturday a crowd of lawyers, journalists and academics gathered in the Lahore drawing room of one of Pakistan's most famous human rights activists to pick at a buffet dinner and watch the results of the country's historic elections unfurl on two large televisions.
The guest list was a who's who of Pakistan's left-leaning, liberal intelligentsia, the sort of people traditionally expected to vote for the Pakistan People's party (PPP).
But there was no hand-wringing when it became clear that Nawaz Sharif, the rightwing business tycoon who once tried to turn Pakistan into an Islamic caliphate, was set to win an unprecedented third term with a thumping majority. If anything, there was quiet satisfaction.
"Right now people think he is the best hope the country has," said a media doyenne. "A decade ago the liberals would have been very wary."
During two stints in power in the 1990s, Sharif locked up journalists, tried to enact sharia law and sacked the Supreme Court. A billionaire steel magnate, he was dogged by allegations that some of his wealth had come through kickbacks on government contracts, illegal writeoffs of loans and blatant tax evasion. He reportedly paid just $10 income tax in 1999.
But old foes and longstanding friends say Sharif is a changed man. They argue that the 63-year-old leader of the Pakistan Muslim League-Nawaz (PML-N) is the best equipped to tackle a daunting in-tray, including a failing economy, chronic energy shortages and an ever-rising tide of extremism.
Sharif has scored full marks for refusing to conspire with the army to bring down the last government, something of a tradition in a country that has seen three bouts of military rule.
Instead he chose to allow the stumbling coalition led by the PPP to become the first elected government ever to finish a full five-year term. He earned the mockery of critics who accused him of running a "friendly opposition".
Such patience is quite a change for a man who went into politics in the late 1970s to defend family interests after his father's metal factories were nationalised by the PPP. Throwing in their lot with Zia-ul-Haq, the military dictator who ruled for 10 years after 1978, the Sharifs regained their property. In the 1980s, Nawaz served as finance minister and chief minister of Punjab, Pakistan's richest and populous province.
He became prime minister first from 1990-1993, when he specialised in getting into fights with anyone who stood in his way, including President Ghulam Ishaq Khan, who tried to fire Sharif before conspiring with the army to force fresh elections.
In his second government in 1997 he took care to dispense with opponents, including an army chief, General Jehangir Karamat, whom he replaced with a handpicked general called Pervez Musharraf.
That was a mistake - Musharraf would later arrest Sharif after mounting a coup against him in October 1999.
Sharif says his entire outlook was changed by the misery of arrest and exile in Saudi Arabia and the UK. To his immense anguish he was banned from returning to Pakistan to bury his beloved father.
He finally returned in 2007 a transformed man and not only, as his enemies love to point out, because his bald scalp had gained hair transplants. He was convinced that Pakistan could succeed only if the military stopped interrupting periods of democratic rule.
During 14 months in prison he caught a BBC programme in which senior Indian politicians were arguing over their country's biggest achievement since independence.
"After an hour and a half of debate, the consensus was that the big achievement of India is that India has upheld the sanctity of the ballot box," Sharif told Newsweek Pakistan recently.
"Nobody said the nuclear bomb. Nobody said roads, bridges and highways. Nobody said anything else."
For all his efforts to protect Pakistan's fragile democracy, Sharif remains obsessed with big infrastructure projects, some of which are of questionable value.
During his second term he built a motorway from Lahore to Islamabad, lavishing time on personally inspecting progress.
Today it is a gloriously smooth ride, but largely empty. Critics say the motorway was built 60 miles longer than necessary to please political allies who wanted it to come through their constituencies.
He is promising more motorways and a bullet train from Karachi to Peshawar. In the past five years, with the PML-N controlling the Punjab provincial government, he has been criticised for expensive schemes, including diverting much of the education budget towards a handful of showpiece "Daanish" schools for underprivileged children.
A fan of the free market, he hopes to overhaul Pakistan's subsidy-devouring state industries, and favours the privatisation of the railways and national airline. He is also determined to restart efforts made under his last government to improve relations with India. The two countries have fought three major wars with each other since 1947.
Today it is almost impossible for Indians and Pakistanis to travel through their once common home. Trade is negligible and Pakistan is forced to spend huge chunks of its meagre public revenues on defence.
This year Sharif told Caravan magazine that India and Pakistan had become trapped in an arms race. "We waste all our money on F-16s. They buy tanks, we also buy tanks. We also waste our resources. Both countries have wasted billions of dollars into building up defence," he said.
"I think we should sit down with India. Both countries - you have to do it together - just as America and the Soviet Union figured it out, India and Pakistan need to figure it out, too."
The implicit challenge to Pakistan's vast defence budget is extremely bold. Few politicians dare to take on the all-powerful military establishment and risk having their patriotism called into question.
Just days before last week's election Sharif told an Indian journalist he would order an inquiry into the 2008 attacks on Mumbai.
"Sometimes conservatives are good at making peace with their enemies," said Mushahid Hussain, a member of Sharif's cabinet in his second government, but now a senator for another party.
"Mr Sharif is from heartland Punjab, from a right-of-centre party with Islamic colouring. That puts him in a more credible position to take the peace process forward without being attacked for appeasement."
Some argue that Pakistan has changed at least as much as the portly prime minister since 1999. Autocratic rule is far trickier, given the emergence of a fiercely independent judiciary and a pugnacious, multichannel media.
Others are prepared to give Sharif the benefit of the doubt. One former enemy said the years living in exile in Saudi Arabia had partly cured Sharif of any enthusiasm he might have once had for giving religion an even bigger role in national affairs.
Sharif has said he regrets his strong support for the Taliban government in Afghanistan in the late 1990s, saying Pakistan should no longer aspire to meddle in the affairs of its smaller neighbour.
But Sharif is going to have to work hard to maintain the goodwill that gave him a landslide victory on a historically high turnout.