Is the landlord allowed to ask for a deposit?
From a juridical standpoint, there are no objections concerning the request of a deposit. If the rented accommodation is in a good state when you leave as a tenant, you will receive back the paid deposit. If the rented accommodation is not in the state that was originally agreed upon,, or when rent has not been paid, then the landlord can compensate the damage with the paid deposit.
Note: It is strongly advised to pay the deposit through a transfer. This way you can always prove the fact that you paid your deposit (and how much). Does your landlord insist on receiving the deposit in cash? Then always ask for a (signed) proof of payment so that the landlord can never deny afterwards having received a deposit from you as a tenant.
Normally speaking, the amount of deposit equals one month of rent. In case you are paying a lower rent, it might occur that the landlord asks for two months of deposit. In general, deposits of more than two months are not considered reasonable.
At the time of departure, your landlord will inspect the rented accommodation. In case damages or other defects are detected, the landlord can hold the tenant responsible and compensate the suffered damages with the paid deposit. When you disagree as a tenant, you can start a procedure in order to still get the full amount of deposit refunded. In this case, the landlord has to prove that something is actually wrong about the rented space that you as a tenant can be held accountable for. In other words, the burden of proof lies with the landlord.