Why is nitric acid added to sodium extract before adding silver nitrate for testing halogens?

While testing the lassaigne’s extract for the presence of halogens, it is first boiled with dilute nitric acid. This is done to decompose NaCN to HCN and Na2S to H2S and to expel these gases. That is, if any nitrogen and sulphur are present in the form of NaCN and Na2S, then they are removed. The chemical equations involved in the reaction are represented as


NaCN + HNO3 NaNO3 + HCN


Na2S + 2HNO3 2NaNO3 + H2S


25