(2)Where [a Judicial Magistrate of the first class or a Metropolitan Magistrate, as the case may be,] imposes a fine for a contravention of this section, he may direct the amount of such money or the value of the property subject to such deduction as aforesaid, if any, or the property itself to be forthwith paid or delivered to the seaman or apprentice.