(1) Where a debtor has become a bankrupt (whether on a creditor's petition or otherwise and whether before or after the commencement of this section), the trustee may give to the sheriff or to the registrar or other appropriate officer of a court, notice in writing of that fact and, upon the giving of the notice:
(a) the sheriff shall deliver or pay to the trustee:
(i) any property of the bankrupt in his or her possession under a process of execution issued by or on behalf of a creditor;
(ii) any proceeds of the sale of property of the bankrupt or other moneys in his or her possession, being proceeds of the sale of property sold, whether before or after the bankrupt became a bankrupt, in pursuance of any such process or moneys seized, or paid to avoid seizure or sale of property of the bankrupt, whether before or after the bankrupt became a bankrupt, in pursuance of any such process; and
(iii) any moneys in his or her possession as a result of the attachment, by or on behalf of a creditor, of a debt due to the bankrupt; or
(b) the registrar or other officer of the court shall pay to the trustee:
(i) any proceeds of the sale of property of the bankrupt or other moneys in court, being proceeds of sale or other moneys paid into court, whether before or after the bankrupt became a bankrupt, by a sheriff in pursuance of a process of execution issued, by or on behalf of a creditor, against property of the bankrupt; and
(ii) any moneys in court that have been paid into court, whether before or after the bankrupt became a bankrupt, in pursuance of proceedings instituted, by or on behalf of a creditor, to attach a debt due to the bankrupt;
as the case requires.
(2) Where property is, or the proceeds of the sale of property or other moneys are, required by subsection (1) to be delivered or paid to the trustee, the costs of the execution or attachment, as the case may be, are a first charge on that property or those proceeds of sale or other moneys, as the case may be.
(3) For the purpose of giving effect to the charge referred to in subsection (2), the sheriff, registrar or other officer of a court may retain on behalf of the creditor entitled to the benefit of the charge, such amount from the proceeds of sale or other moneys referred to in that subsection as he or she thinks necessary for the purpose.
(4) Where a sheriff, registrar or other officer of a court has, in pursuance of subsection (1), delivered property or paid moneys to the trustee, the creditor who issued the process of execution or instituted the attachment proceedings, or on whose behalf the process was issued or the proceedings instituted, as the case may be, may prove in the bankruptcy for his or her debt as an unsecured creditor as if the execution or attachment, as the case may be, had not taken place.
(5) Where:
(a) a sheriff, registrar or other officer of a court has, in pursuance of subsection (1), delivered to the trustee property that was seized, or paid to the trustee the proceeds of the sale of property or other moneys that were received, as a result of the issue of execution against property of a bankrupt or the attachment of a debt due to a bankrupt; and
(b) that property or debt would not have been property divisible amongst the creditors of the bankrupt if the bankrupt had become a bankrupt immediately before the execution was issued or the debt attached, as the case may be;
the trustee shall deliver that property, or pay those proceeds or other moneys, as the case requires, to the bankrupt or to a person authorized by the bankrupt in writing for the purpose.
(6) Where:
(a) property has been delivered by a sheriff, or the proceeds of the sale of property or other moneys have been paid by a sheriff, registrar or other officer of a court, to the trustee of the estate of a bankrupt in pursuance of subsection (1); and
(b) the property was in the possession of the sheriff, or the proceeds of the sale of the property or the other moneys were in the possession of the sheriff or paid into court, as the case may be, under or in pursuance of a process of execution issued, or proceedings to attach a debt instituted, by or on behalf of a creditor in respect of a liability of the bankrupt under a maintenance agreement or maintenance order (whether entered into or made, as the case may be, before or after the commencement of this section);
the trustee shall deliver that property, or pay those proceeds or other moneys, as the case requires, to that creditor.
(7) A failure by a sheriff to comply with a provision of this section does not affect the title of a person who purchases property of a bankrupt in good faith under a sale by the sheriff in pursuance of a process of execution issued by or on behalf of a creditor.