The scholars differentiate between two types of debts:
- Long-term debt: Which is a debt repaid on fixed installments for more than a year. Mortgages from studying, buying a house, car and the like would be of this kind.
- Short-term debt: Which is a debt immediately due within a year.
This differentiation is important when it comes to zakat, since one can only subtract the entire amount if it is a short-term debt.
Long-term debts are not dedcutable, except for the immediate installment.
Consider the following example:
Assume the zakatable-minimum (nisab) is $2000.
One’s zakatable assets amount to &5000.
One has an outstanding mortgage of $50.000 with fixed monthly installments of $500. This would be a long-term debt. As such one can only subtract the upcoming installment of $500, and has to pay zakat on $4500.
A student-loan would be a long-term debt. Hence the entire debt is not deductable.
However, if you have started repaying the debt, then it would be possible to dedcut the upcoming installment.
Considering the above, the money you have donated has in fact been zakat.