When a Court of Session or a Magistrate of the first class convicts a person of any of the offences specified in Sub-section (2), or of abetting any such offence, and believes that it is necessary to take security from the convicted person for keeping the peace, the Court may, at the time of passing sentence, order the person to execute a bond, with or without sureties, for keeping the peace for a period not exceeding three years, as the Court deems fit.
(2) The offences referred to in Sub-section (1) are:
(3) If the conviction is set aside on appeal or otherwise, the bond executed under this section shall become void.
(4) An order under this section may also be made by an Appellate Court or a Court exercising its powers of revision.