After being out of power for 13 years, 7 months, and 21 days, Nawaz Sharif was reelected prime minister of Pakistan on June 5, 2013.

This prosaic electoral event brought substantial hope for Pakistan’s future and marked several firsts.

It was the first time in Pakistan’s turbulent political history that one democratically elected government served out its full term and passed the reins of power to a democratically elected government from a different political party. For half of its history Pakistan has been ruled by the military and dictators.

It was also the first time a Pakistani prime minister won a third term. Sharif’s previous two terms, 1990-1993 and 1997-1999, ended early and abruptly due to internal dissent leading ultimately to his exile in Saudi Arabia for seven years in 2000.

Many hope Sharif’s majority support will enable him to tackle some of the country’s persistent problems, such as terrorism, corruption, power shortages, regional disputes, a sluggish economy, U.S. drone strikes, and sour relations between the civilian government and the military.

But the road ahead looks difficult.

From its postcolonial beginnings in 1947, Pakistan’s political elites have faced regional, communal, and religious obstacles to building a stable, enduring political structure. It took years to produce the first constitution and even longer to hold national elections. Debates raged over whether Pakistan should be a secular or Islamic state and over which regional and political elites should rule.

At the same time, Pakistan suffered from complexities of geography and poor relations with neighbors. It began independent life divided into the almost unworkable split of West and East Pakistan (today’s Bangladesh). And it has struggled against its larger neighbor India over control of territory.

Today, Pakistan confronts the destabilizing effects of the U.S.-led war in Afghanistan, the spread of Taliban forces across the region, and a changing relationship with the United States (its ally for decades).

So far, the optimism of last summer’s political transition seems premature. With increasing terrorist attacks and the imposition of Sharif’s controversial new security laws, discontent is mounting. On December 24, 2013, a Gilani Research Foundation opinion poll that showed that only 27% of Pakistanis believe the country is moving in the right direction.

Pakistan’s fresh start has yet to materialize.

An Inauspicious Beginning: Independence and Partition

Salmon Rushdie has famously described Pakistan as “a place … insufficiently imagined.”

Pakistan shook itself free from the United Kingdom in 1947 after almost 100 years of colonial control under the British Raj. The long process of gaining independence had been dominated by two nationalist organizations, the Indian National Congress led by Mohandas K. Gandhi and the Muslim League led by Muhammad Ali Jinnah.

Gandhi and the Congress argued that despite South Asia’s complicated mosaic of ethnicities, languages, and religions the entire population shared a single nationality. They were Indian.

Jinnah, in his “Two Nations Theory,” argued that while they may live side by side, the Hindus and Muslims of South Asia constituted two separate nations.

In a single polity, Jinnah worried, the Muslims of South Asia would become a permanent minority with little political influence and few if any rights. Therefore, the Muslims of South Asia needed their own homeland: Pakistan.

But what was Pakistan to be? Some proposals suggested that it be a highly autonomous region inside a larger Indian federation while others advocated a separate sovereign state.

When it came time for independence, the British, Muslim League, and Congress agreed to partition all of South Asia between Pakistan and India. Areas with substantial Muslim majorities were assigned to Pakistan.

However these Muslim majority zones were not geographically contiguous so that Pakistan had two “wings,” East and West, a thousand miles apart. Moreover, the large provinces of Punjab and Bengal were both split into two so that Muslim-majority West Punjab and East Bengal joined Pakistan while East Punjab and West Bengal went to India. The borders between India and Pakistan were hurriedly determined by the Radcliffe Commission. Jinnah denounced the boundaries of this “moth-eaten Pakistan.”

Partition was accompanied by the movement of millions of refugees who found themselves on the “wrong” side of the new borders. Fleeing chaos and sometimes grotesque violence among Hindus, Muslims, and Sikhs, refugees arrived in their new countries destitute. Governments struggled to respond because few had anticipated the vast scale of migrations.

One of the most serious territorial disputes between India and Pakistan was the status of the province of Kashmir.

Located in the Himalayas, Kashmir shared borders with Pakistan and India and both countries laid claim to it. War erupted, and with the ceasefire in 1948 India occupied about two thirds of the province with Pakistan holding the other third. The war was costly to both countries, but it settled little.

The status of Kashmir has continued to be a flashpoint between them to this day. And Pakistan’s fear of the larger Indian military has resulted in an outsized proportion of its budget going to defense—up to 70% early on.

At the same time, the new government of Pakistan faced numerous other problems.

Jinnah preferred for Pakistan to have a secular liberal democracy, but this sentiment was not necessarily widely shared by the new nation’s citizens and leaders.

Pakistan started off at a disadvantage economically and institutionally. The republic of India inherited the assets of British India including the capital in New Delhi. India and Pakistan negotiated a division of other assets like military equipment, office furniture, and gold reserves, but much of Pakistan’s share was never delivered. The government of Pakistan occupied temporary facilities in Karachi until the construction of a new capital in Islamabad in 1960.

According to historian Ian Talbot, “the Pakistani sense of inferiority and insecurity was psychologically rooted in the country’s status as a seceding state rather than inheritor of the Raj. Membership of international organisations such as the United Nations devolved upon India, whereas Pakistan had to go cap-in-hand to apply for membership.”

Pakistan, the Early Years: Political Instability and Regional Fighting

Independence unleashed a wide spectrum of competing political parties and ideologies, not least between East and West Pakistan. In this atmosphere, political elites failed to create a stable and legitimate political structure. Less than 10 years later, Pakistan was under military rule.

Led by Jinnah, the Muslim League had been the driving force behind the demand for an independent Pakistan in the 1940s. As Jinnah’s prestige and authority were unmatched in 1947, he became the head of state, Governor-General, of Pakistan. But he died the following year leaving a power vacuum.

The Constituent Assembly, tasked with writing a constitution and serving as an interim parliament, lost its legitimacy rapidly. Its members had not been elected in 1947, and while the assembly dithered and debated, the Government of India Act of 1935 (revised in 1947) served as an interim constitution for Pakistan until 1956.

Liaquat Ali Khan, who was named prime minister in 1947, found it difficult to craft a consensus despite his considerable influence. Difficult issues included the Islamic character of the state and legal system; should the new state follow British legal precedents or sharia?

East Pakistan had a larger population while West Pakistan had the greater political influence, exacerbating disagreement over a federal system. Advocates for a strong central government argued that a powerful center was necessary to pull the country together, while advocates for stronger provinces argued that a weak center would preserve local differences.

Following from the multi-lingual nature of Pakistan was the question of the national language. On one hand, they wanted to avoid using English, which was the language of imperialism, but on the other there was no Indian language common to all parts of the country.

In East Pakistan the vast majority of the population spoke Bengali, little used in the West, where dozens of languages were spoken. Punjabi had the most speakers, but almost all lived in Punjab province.

In the end, the national government chose Urdu even though few people spoke it. Urdu was the mother tongue of many of the refugees from north India, but for most of the population, it was a literary language learned by the elite.

Pakistan’s contentious beginnings culminated in the controversial Public and Representative Office Disqualification Act (PRODA) in 1949—which created categories of political crimes—and the 1951 legal case known as the Rawalpindi Conspiracy Case in which 11 people including Major-General Akbar Khan and members of Pakistan’s Communist Party were accused of plotting a coup. The government then cracked down on trade unions and several prominent writers. A few months later, the prime minister was assassinated.

The next prime minister, Khawaja Nazimudden, a Bengali politician, tried to bring some order to the political system but remained in office for only two years. He declared martial law in 1953, but was soon dismissed from office by the Governor-General. Another politician from East Pakistan, Chaudhri Muhammad Ali, was then named prime minister, and finally succeeded in getting a constitution approved by the Constituent Assembly in 1956.

The momentum towards political stabilization, however, did not last.

The new constitution provided for a general election but it was never held due to disagreements over how electoral districts would be drawn up. The Constituent Assembly continued to serve poorly as an interim parliament for two more years until martial law was declared in 1958.

Regional tensions exacerbated the political difficulties in both wings of the country. In East Pakistan, a crisis erupted in the provincial Legislative Assembly first over the authority of the speaker and then the budget. The government of East Pakistan lost a confidence vote in the assembly and President Iskander Mirza imposed “President’s Rule.”

In West Pakistan, the situation also deteriorated. The Muslim League created its own paramilitary force while the Pashtun leader Abdul Ghaffar Khan, a supporter of Mahatma Gandhi, opponent of Partition, and advocate of democracy, pressed his supporters to defy the government.

The threat of civil war was all too real.

In 1958, Mirza declared martial law and appointed General Muhammad Ayub Khan to the position of Chief Martial Law Administrator and then named him prime minister. After three weeks, Ayub Khan forced Mirza out of office and assumed the presidency.

The rising young politician Zulfikar Ali Bhutto—whose family came to play a central political role in Pakistan—joined the government as minister of commerce.

This was not the Pakistan envisaged by Jinnah and the other founders.