The Muslim-majority state of Pakistan 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 break-up of the two wings came in 1971 when the Bengali-speaking east wing seceded with help from India to become the independent state of Bangladesh.
Development in Pakistan has been hampered by Islamist violence and economic stagnation, and relations with its key neighbours India and Afghanistan are often fraught.
Islamic Republic of Pakistan
Population 197 million
Area 796,095 sq km (307,374 sq miles), excluding Kashmir
Major languages English, Urdu, Punjabi, Sindhi, Pashto, Balochi
Major religion Islam
Life expectancy 66 years (men), 68 years (women)
Currency Pakistani Rupee
President: Arif Alvi
Arif Alvi is a long-standing member of the governing Tehreek-e-Insaf (PTI) party, and has served two terms as a member of parliament.
He was elected by parliament in September 2018 to succeed Mamnoon Hussain, whose five-year term had come to an end.
Pakistan is a parliamentary republic where the prime minister wields most power, but presidents have often played key roles in constitutional crises.
Prime Minister: Imran Khan
The former international cricket star Imran Khan rode to victory in the 2018 general election on a pledge to end corruption.
He turned to politics in 1996 with his Pakistan Tehreek-e-Insaf (PTI) party, which achieved a breakthrough at the national level in 2013. It went on to hit the conservative Pakistan Muslim League-Nawaz government of Nawaz Sharif with accusations of graft.
During the 2018 campaign Mr Khan faced accusations - which he denied - of being the favoured candidate of Pakistan's powerful army, and that military intelligence was working to discredit his rivals.
The PTI party won 116 of the 272 seats up for grabs, and joined with several smaller parties to form a majority in parliament.
Mr Khan's critics accuse him of appeasing Islamist extremists and of being vague about his plans to tackle poverty, economic stagnation, and other deep-seated social problems.
Pakistan is one of the world's deadliest countries for journalists, with 14 media workers being killed in 2014 alone. Both intelligence agents and members of banned militant organisations are responsible for the threats to reporters, according to media watchdog organisations.
The government uses legal and constitutional powers to curb press freedom and the law on blasphemy has been used against journalists. Critics have raised concerns over the restrictive nature of a new code of conduct for broadcasters introduced in 2015.
Some key dates in Pakistan's history:
1947 - Muslim state of East and West Pakistan created out of partition of India at the end of British rule.
1948 - First war with India over disputed territory of Kashmir.
1971 - East Pakistan attempts to secede, leading to civil war. India intervenes in support of East Pakistan which eventually breaks away to become Bangladesh.
1999 - Army chief Pervez Musharraf seizes power in coup, ousting Prime Minister Nawaz Sharif.
2007 - Former Prime Minister Benazir Bhutto is assassinated while on campaign trail for 2008 parliamentary election.
2018 - Former international cricket star Imran Khan becomes prime minister on a pledge to end corruption and dynastic politics.