Guarantor's right in compensation

Article 1280 of the Civil Code of the Philippines provides:
ART. 1280. Notwithstanding the provisions of the preceding article, the guarantor may set up compensation as regards what the creditor may owe the principal debtor. (1197)
The extinguishment of the principal obligation due to compensation carries with it the accessory obligation. A guarantor's obligation is an accessory one. Therefore, the guarantor is given the right to set up compensation as regards what the creditor may owe the principal debtor. (De Leon, 2014).