(a)   Issuance. When a judgment or order is for the delivery of possession of real property, the judgment or order shall direct the clerk to issue a writ of possession. The clerk shall issue the writ forthwith and deliver it to the sheriff for execution.

(b)   Third-Party Claims. If a person other than the party against whom the writ of possession is issued is in possession of the property, that person may retain possession of the property by filing with the sheriff an affidavit that the person is entitled to possession of the property, specifying the nature of the claim. Thereupon the sheriff shall desist from enforcing the writ and shall serve a copy of the affidavit on the party causing issuance of the writ of possession. The party causing issuance of the writ may apply to the court for an order directing the sheriff to complete execution of the writ. The court shall determine the right of possession in the property and shall order the sheriff to continue to execute the writ or shall stay execution of the writ, if appropriate.