The Muslim-majority state of Pakistan occupies an area which was home to some of the earliest human settlements and where two of the world's major religions, Hinduism and Buddhism, were practised.
The modern state was born out of the partition of the Indian sub-continent in 1947 and has faced both domestic political upheavals and regional confrontations.
Created to meet the demands of Indian Muslims for their own homeland, Pakistan was originally made up of two parts.
The east wing - present-day Bangladesh - is on the Bay of Bengal bordering India and Burma. The west wing - present-day Pakistan - stretches from the Himalayas down to the Arabian Sea.
The break-up of the two wings came in 1971 when the Bengali-speaking east wing seceded with help from India.
The disputed northern territory of Kashmir has been the flashpoint for two of the three India-Pakistan wars - those of 1947-8 and 1965. There was a further brief but bitter armed conflict after Islamic militants infiltrated Indian-administered Kashmir in 1999.Military dominance
Civilian politics in Pakistan in the last few decades has been tarnished by corruption, inefficiency and confrontations between various institutions. Alternating periods of civilian and military rule have not helped to establish stability.
Pakistan came under military rule again in October 1999 after the ousting of a civilian government that had lost a great deal of public support.
The coup leader, General Pervez Musharraf, pledged to revive the country's fortunes, but faced economic challenges as well as an increasing polarisation between Islamist militancy and the modernising secular wing of Pakistani politics.
Under growing pressure to reintroduce democratic rule, Mr Musharraf relinquished his army post in November 2007, but at parliamentary elections in February 2008, his supporters were defeated by the opposition Pakistan People's Party and former prme minister Nawaz Sharif's Muslim League.
The two parties formed a coalition government and an impeachment process was launched against Mr Musharraf, who resigned in August 2008. The Muslim League soon went into opposition, leaving the People's Party to govern in coalition with smaller parties.
Parliamentary elections in 2013 brought the Muslim League back to power in the first transition from one elected government to another at elections in the country's history.Border tensions and terror
Pakistan's place on the world stage shifted after the 11 September 2001 attacks in the US. It dropped its support for the Taliban regime in Afghanistan and was propelled into the frontline in the fight against terrorism, becoming a notional ally of Washington.
However, Pakistani forces have struggled to maintain control over the restive tribal regions along the Afghan border, where Taliban-linked militants became firmly entrenched. These Sunni extremists have more recently expanded attacks from their border fastness to target minority groups elsewhere in the country, in particular Shia Muslims and Christians.
Since 2009, the government has been waging an on-and-off military campaign to flush the militants out of the tribal areas.
It repeatedly denied US and Afghan allegations that senior al-Qaeda and Taliban leaders were present in the border areas, or that its intelligence service ISI even had links to Afghan armed groups. So the death in April 2011 of al-Qaeda chief Osama Bin-Laden in a US raid on Abbottabad, a city in the heart of Pakistan's military establishment, stretched relations with the US to breaking point.
Tensions with India over Kashmir have resurfaced regularly ever since the partition of the sub-continent, and the two nuclear-armed powers have on numerous occasions been on the brink of renewed conflict.
India has accused Pakistan of failing to cooperate adequately over the investigation into the November 2008 extremist attacks in Mumbai, and suspended talks on improving relations until May 2012, when civil servants agreed to resume contacts.