(4)Where a seaman or apprentice is brought before a Court on the ground of desertion or of absence without leave or of any offence against discipline, and the master or the owner, or his agent, so requires, the Court, may, in lieu of committing and sentencing him for the offence, cause him to be conveyed on board his ship for the purpose of proceeding on the voyage, or deliver him to the master or any mate of the ship or the owner or his agent, to be by them so conveyed, and may in such case order any costs and expenses properly incurred by or on behalf of the master or owner by reason of the conveyance to be paid by the offender and, if necessary, to be deducted from any wages which he has then earned or by virtue of his then existing engagements may afterwards be earned.