According to the law, a guarantor pays the creditor if the borrower is unable to repay the debt in accordance with the terms of the contract.