As a deterrent both on a strategic & tactical level ! A strategic nuke to tell (say!) Russia that you can't eye ball us with threatening to go Nuclear & a tactical nuke to tell them - Hey...'this is our red-line' you cross it & we'd lob one (say Pakistan's Al-Nasr) onto your incoming formation or the nearest base that you're operating from ! We know that you're going to retaliate & you know we'd retaliate in response to your retaliation so do you want to escalate things or do you want to respect our red-lines ? The deterrent essentially is in the form of - How many men are both of us risking to find out whether we'd go nuclear at a tactical level or not ? Due to the stakes involved that risk will never be taken.
The strategic scenario won't come into the fray but the tactical one can & does ! Why do you think Pakistan wasn't attacked by India during the 26/11 attacks on Mumbai by terrorists who had come from Pakistan or why in 2002 our military stand-off never escalated into anything ? Not because of enormous restraint shown by the Indians because it was the decent & responsible thing to do but because both Army High Commands calculated the probable casualties a conventional war would do & then factored in highly mobile air, land & TEL launched platforms available to Pakistan across the board eying Indian Forward Operating Basis & formations & vice versa for the Pakistani High Command in factoring in what the Indians had & realizing that anything more than a stand-off or even a sorry excuse for a border skirmish had the propensity of culminating in a full-scale war & in it whether its Pakistan using tactical nukes against the Indian Carrier Group or against the majority of India's FOBs, India's reply to that & Pakistan's reply to their reply would ensure that we'd have killed off most of our armed forces along with most civilians in the vicinity ! That mutually assured destruction was & is the biggest deterrent to any subsequent conflicts between Pakistan & India ever being anything more than stand-offs or some cross-border fire - Never anything close to a full scale battle...never mind a full scale war.