How difficult can it be to entrench the institutions and procedures of democracy in a nation-state established with the specific intention of becoming one? Both democratic fundamentalists and political realists should look at the example of Pakistan, which goes to the polls this weekend.

Pakistan traces its birth as a nation-state to 1947, when it was formed out of the old landmass of colonial India and the desire of a sizeable section of the subcontinent's Muslims to have a state of their own. But, remarkably, the elections this weekend will mark the first occasion in the country's history that a democratically elected civilian government has seen out its entire five-year term and set up a transition to the next one.

Almost from the beginning, the country has been held to ransom by an excessively powerful military. The army has persistently exploited the fragility of Pakistan's nascent democratic institutions, the tensions of postcolonial politics (primarily the adversarial relationship with India, as well as battles over the state of Kashmir and over what was formerly East Pakistan and is now Bangladesh), and the stresses and opportunities of Pakistan's geopolitical situation as a neighbor of Afghanistan and, since the nineties, as a nuclear state.

Pakistan has been under military rule for more than half of its history, most notably under General Zia-ul-Haq from 1978 to 1988 and most recently under General Pervez Musharraf from 2001 to 2008. It's fashionable, therefore, among Indians who like their foreign-policy tittle-tattle to think of India "a state with an army" and Pakistan by contrast as "an army with a state."

For more than six decades, Indians have viewed the political and economic discontents of Pakistanis with the mixture of sympathy and schadenfreude that inevitably arise when a centuries-old civilization breaks up into two somewhat arbitrarily formed nation-states. Further, the two countries were racked at their origins by the massive two-way migration of peoples and the enormous bloodbath that was Partition. The relationship between the two countries was summed up acutely by the Indian sociologist Ashis Nandy in a book-length interview in 2006 when he said:

The Indian attitude to Pakistan is very strange. Very few want to know about Pakistan; only a few seem curious about what is happening there. Yet, most Indians think they know everything about Pakistan. Almost the same thing can be said about Pakistan. I don't think many Pakistanis know anything about India, except probably about Indian films which, I am told, they like. But every Pakistani thinks he knows India. So many of my Pakistani friends say that when they bring their children to India, the first thing their surprised children say is, "Look, they look just like us and they speak like us."

It's a love-hate relationship on both sides. It's almost as if the bitterness came from the splitting of a joint family, and each one was terribly, curious and nostalgic at the same time. Like a couple who are divorced after being deeply in love. Both claim that the divorce has been good for them, but both are bitter and curious about what the other is doing -- what vegetables, furniture, or books the other buys in the market, and what he or she does with the children and the house. And both sides are constantly looking for evidence of how bad the other is. The venom is partly a defence against recognizing how much emotional cross-investment there is in each other.

As Pakistan goes to the polls, Indian newspapers have been flush with analysis and predictions. And a clear indicator of how much is at stake in the elections of 2013 is the violence unleashed in recent weeks by forces within Pakistan that stand to gain most from the destabilization of democracy. The election campaign is already the bloodiest in Pakistan's history, with more than 100 people killed in violence sponsored mainly by the Pakistani Taliban and the Balochi separatist movement and directed mainly at candidates from the ruling Pakistan People's Party and the liberal Muttahida Quami Movement.

The PPP came to power in 2008 on a massive sympathy wave after the assassination of its leader, the former Prime Minister Benazir Bhutto. This time around, after an unconvincing five years in power, its chances appear bleak. The momentum appears to be with its main rival, the Pakistan Muslim League-Nawaz, headed by Nawaz Sharif, himself a two-time prime minister, and seen as much more sympathetic to the powerful religious right than the recent regime.

Sharif was the victim of a coup by Musharraf in 1999. He was banished to six years in political exile in Saudi Arabia before returning to Pakistan in 2007. Sharif's adventures in Pakistani politics have made him both bitter and wise. In a recent piece titled "Nawaz Sharif On The Cusp of Power," the journalist Mira Sethi shows how Sharif cleverly combines religious rhetoric with an agenda for economic development, and also displays a new maturity about the precedence of democratic institutions over personal rivalries:

Sharif professes to draw inspiration from Sher Shah Suri, the Mughal-era builder of roads and works who is credited with constructing the Grand Trunk Road that links India, Pakistan and Afghanistan. (On one of the PMLN’s official Facebook pages, Sharif’s round face has been photoshopped inside Suri’s bronze helmet.) In Mardan, Sharif promised the crowd he would build a bullet train from Karachi to Peshawar: the train would leave Karachi after the fajr prayer, at dawn, and arrive in Peshawar just in time for the evening isha prayer. He pointedly mentioned that passengers would have to perform only the afternoon prayer inside their cabins. It was a classic Sharif image, blending the promise of economic development with the rhetoric of religion. "The way he frames modern requirements within the framework of religion, or social conservatism, is frankly impressive," the television anchor and columnist Nasim Zehra told me. "He’s the only one who can do it."...

In spite of his flaws—corruption, autocratic tendencies, a limited attention span—Sharif has recast himself as a defender of democracy and a critic of military interference in civilian affairs. In stark contrast to the intrigues of the 1990s, when Sharif and Benazir Bhutto took turns ejecting one another from office in collaboration with the army, Sharif has spent the past five years in opposition without attempting to bring down the PPP government, and in fact stood with it against such challenges, to the extent that he has been lampooned as "the friendly opposition." Although Sharif remains a deeply conservative industrialist with ties to Pakistan’s religious right, many liberals cautiously admire his stance on three key issues: bringing the army to heel, pursuing peace with India and defending parliamentary democracy—areas in which Sharif’s views have clearly evolved in the wake of his own ouster, imprisonment and exile 14 years ago at the hands of General Pervez Musharraf.

Sharif appears to most fear the challenge not from the PPP, but rather the Pakistan Tehreek-e-Insaf, a party led by a relative political neophyte, the charismatic former cricketer Imran Khan. He is an outsider who claims he will clean up the system if voted to power. He also has cleverly exploited anti-American sentiment in Pakistan, thereby earning himself some relief from political violence. He has a vast following among Pakistani youth, which is useful in an electorate where about 40 million will be eligible to vote for the first time at these elections.

Earlier this week, Khan was badly injured when he fell from the stage during a political rally, leaving him unable to vote but possibly more attractive to the undecided voter. At the very least, he may turn out to a decisive political spoiler, one that any future government will have to broker a deal with. It's Imran that Sharif seemed to be pointing to when he warned this week of the dangers of a fractured mandate and a coalition government.

Whatever the outcome, a second straight run for democracy in Pakistan can only be good for the country -- and indeed for India-Pakistan relations. If there's a more ambitious aspiration, though, that liberals in both India and Pakistan hold in common, it's a shift over the longer term in the orientation of the Pakistani state away from an official religion.

Pakistan's current constitution, in the words of one of its most committed human-rights activists, "brazenly discriminates" against religious minorities, mostly Hindus, Christians and members of the reviled Ahmadiyya community, who between them number about 4 to 6 million. The president and prime minister are constitutionally required to be Muslim. Further, Article 227 of the constitution declares that "All existing laws shall be brought in conformity with the Injunctions of Islam as laid down in the Holy Quran," making it harder for liberals and democrats to emphasize citizenship over faith, and easier for militants and autocrats to legitimately promulgate an Islamist mindset.

In the short term, then, it would be great to see Pakistan make the transition to a stable democracy. In the long term, it would be even better -- and more worthy of the complex history of the Indian subcontinent -- to see it become the secular state originally imagined by its founder, Mohammad Ali Jinnah.

(Chandrahas Choudhury, a novelist, is the New Delhi correspondent for World View. Follow him on Twitter. The opinions expressed are his own.)

To contact the author of this blog post: Chandrahas Choudhury at Chandrahas.choudhury@gmail.com

To contact the editor responsible for this post: Max Berley at mberley@bloomberg.net