Does debt prevent paying Zakah on crops?

A farmer borrowed an amount of a crop (i.e. wheat for example) from another person. Afterwards, the time of harvesting the crop had come, so should he exclude the borrowed amount as a debt and pay Zakaah on the rest of the harvest or pay it on all the harvest including the borrowed amount? What would be the case if the harvest does not reach the Nisaab after excluding the borrowed amount?

All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad , is His slave and messenger.

Scholars held different opinions regarding whether or not a debt cancels the Zakah that is due on wealth, especially what is apparent like crops. Some scholars viewed that debt cancels the Zakah of such wealth while others, who are the majority of scholars, viewed that debt does not cancel Zakah.

As-Suyooti  may  Allaah  have  mercy  upon  him explained in Al-Ashbaah wan Nathaa’ir, a book on Shaafi‘i Fiqh, the cases where debt cancels the obligation of Zakah and those where it does not, as he said, "Debt cancels Zakah on hidden wealth such as cash and trade goods but does not cancel it in the case of apparent wealth such as crops, fruits and cattle. This is regardless of whether the debt is imminent or deferred or from the same type of the wealth or not."

Moreover, Al-Hattaab, the Maaliki scholar  may  Allaah  have  mercy  upon  him said: "The Zakah of harvests, minerals and cattle is not waived on account of a debt."

The Hanbali scholars, according to a reported opinion, held that a debt cancels the Zakah on crops. It is also said that the money one borrows to cover the expenses of the crop also cancels the Zakah on crops. The opinion we see as preponderant is that which was adopted by the majority of scholars.

Allaah Knows best.

*Helped by fatwas of islamweb.net