The two South Asian nuclear rivals have twice gone to war over Kashmir since they gained independence from Britain .