Indo-Pakistani wars and conflicts

Since the Partition of British India in 1947 and subsequent creation of the dominions of India and Pakistan, the two countries have been involved in a number of wars, conflicts, and military standoffs. A long-running dispute over Kashmir and cross-border terrorism have been the predominant cause of conflict between the two states, with the exception of the Indo-Pakistani War of 1971, which occurred as a direct result of hostilities stemming from the Bangladesh Liberation War in erstwhile East Pakistan (now Bangladesh).
Background.
The Partition of India came about in the aftermath of World War II, when both Great Britain and British India were dealing with the economic stresses caused by the war and its demobilisation. It was the intention of those who wished for a Muslim state to come from British India to have a clean partition between independent and equal "Pakistan" and "Hindustan" once independence came.
Nearly one third of the Muslim population of British India remained in India.
Inter-communal violence between Hindus, Sikhs and Muslims resulted in between 200,000 and 2 million casualties leaving 14 million people displaced.
Princely states in India were provided with an Instrument of Accession to accede to either India or Pakistan.
Wars.
Indo-Pakistani War of 1947.
The war, also called the First Kashmir War, started in October 1947 when Pakistan feared that the Maharaja of the princely state of Kashmir and Jammu would accede to India. Following partition, princely states were left to choose whether to join India or Pakistan or to remain independent. Jammu and Kashmir, the largest of the princely states, had a majority Muslim population and significant fraction of Hindu population, all ruled by the Hindu Maharaja Hari Singh. Tribal Islamic forces with support from the army of Pakistan attacked and occupied parts of the princely state forcing the Maharaja to sign the Instrument of Accession of the princely state to the Dominion of India to receive Indian military aid. The UN Security Council passed Resolution 47 on 22 April 1948. The fronts solidified gradually along what came to be known as the Line of Control. A formal cease-fire was declared at 23:59 on the night of 1 January 1949. India gained control of about two-thirds of the state (Kashmir valley, Jammu and Ladakh) whereas Pakistan gained roughly a third of The Pakistan controlled areas are collectively referred to as Pakistan administered Kashmir.
Indo-Pakistani War of 1965.
This war started following Pakistan's Operation Gibraltar, which was designed to infiltrate forces into Jammu and Kashmir to precipitate an insurgency against rule by India. India retaliated by launching a full-scale military attack on West Pakistan. The seventeen-day war caused thousands of casualties on both sides and witnessed the largest engagement of armored vehicles and the largest tank battle since World War II. The hostilities between the two countries ended after a ceasefire was declared following diplomatic intervention by the Soviet Union and USA and the subsequent issuance of the Tashkent Declaration. India had the upper hand over Pakistan when the ceasefire was declared.
Indo-Pakistani War of 1971.
This war was unique in the way that it did not involve the issue of Kashmir, but was rather precipitated by the crisis created by the political battle brewing in erstwhile East Pakistan (now Bangladesh) between Sheikh Mujibur Rahman, Leader of East Pakistan, and Yahya Khan and Zulfikar Ali Bhutto, leaders of West Pakistan. This would culminate in the declaration of Independence of Bangladesh from the state system of Pakistan. Following Operation Searchlight and the 1971 Bangladesh atrocities, about 10 million Bengalis in East Pakistan took refuge in neighbouring India.
India intervened in the ongoing Bangladesh liberation movement. After a large scale pre-emptive strike by Pakistan, full-scale hostilities between the two countries commenced.
Pakistan attacked at several places along India's western border with Pakistan, but the Indian Army successfully held their positions. The Indian Army quickly responded to the Pakistan Army's movements in the west and made some initial gains, including capturing around of Pakistan territory (land gained by India in Pakistani Kashmir, Pakistani Punjab and Sindh sectors but gifted it back to Pakistan in the Simla Agreement of 1972, as a gesture of goodwill). Within two weeks of intense fighting, Pakistani forces in East Pakistan surrendered to the joint command of Indian and Bangladeshi forces following which the People's Republic of Bangladesh was created. This war saw the highest number of casualties in any of the India-Pakistan conflicts, as well as the largest number of prisoners of war since the Second World War after the surrender of more than 90,000 Pakistani military and civilians. In the words of one Pakistani author, "Pakistan lost half its navy, a quarter of its air force and a third of its army".
Indo-Pakistani War of 1999.
Commonly known as the Kargil War, this conflict between the two countries was mostly limited. During early 1999, Pakistani troops infiltrated across the Line of Control (LoC) and occupied Indian territory mostly in the Kargil district. India responded by launching a major military and diplomatic offensive to drive out the Pakistani infiltrators. Two months into the conflict, Indian troops had slowly retaken most of the ridges that were encroached by the infiltrators. According to official count, an estimated 75%–80% of the intruded area and nearly all high ground was back under Indian control.
Fearing large-scale escalation in military conflict, the international community, led by the United States, increased diplomatic pressure on Pakistan to withdraw forces from remaining Indian territory. 
Faced with the possibility of international isolation, the already fragile Pakistani economy was weakened further. The morale of Pakistani forces after the withdrawal declined as many units of the Northern Light Infantry suffered heavy casualties. The government refused to accept the dead bodies of many officers, an issue that provoked outrage and protests in the Northern Areas. Pakistan initially did not acknowledge many of its casualties, but Nawaz Sharif later said that over 4,000 Pakistani troops were killed in the operation and that Pakistan had lost the conflict. By the end of July 1999, organized hostilities in the Kargil district had ceased.
The war was a major military defeat for the Pakistani Army.
Other armed engagements.
Apart from the aforementioned wars, there have been skirmishes between the two nations from time to time. Some have bordered on all-out war, while others were limited in scope. The countries were expected to fight each other in 1955 after warlike posturing on both sides, but full-scale war did not break out.
Nuclear weapons.
The nuclear conflict between both countries is of passive strategic nature with nuclear doctrine of Pakistan stating a first strike policy, although the strike would only be initiated if and only if, the Pakistan Armed Forces are unable to halt an invasion (as for example in 1971 war) or a nuclear strike is launched against Pakistan, whereas India has a declared policy of no first use.
Annual celebrations.
The nations of South Asia observe national and armed forces-specific days which originate from conflicts between India and Pakistan as follows:
In popular culture.
These wars have provided source material for both Indian and Pakistani film and television dramatists, who have adapted events of the war for the purposes of drama and to please target audiences in their nations.