Deposit recovery from landlord

My wife is an employee of a bank. we made a lease agreement from an owner of a flat on behalf of bank for our accommodation of 33 months. rent was finalised as RS 11,000 per month which will be paid by bank directly to landlord account but deposit of 51000 was done by us as this facility was not given by company. our lease expired on 31st august, 2022. we intimated landlord of vacating flat on 29th of August,2022. I asked for deposit return. Landlord said that I will deduct Rs 15000 and return rest. He said he will do painting of wall and balcony grill painting out of Rs 15000. I said you are deducting more than a month rent for all this. i will complete it. I painted the wall of flat. Then He asked me to paint the grill. I said deduct Rs 1000 for it. Landlord said I will deduct Rs 1500 for this. I said okay. After few days I asked him to return deposits after deduction as discussed. He said return the keys of flat to my broker first. I denied and said that as per your wish i did all, now you first return my deposit then i will handover keys. i also said that you also allowed in your flat after i submitted deposit with you. so, plz give deposited then i will return keys. He said i will deduct rent from your deposit. i said in reply that i will keep keys for a year if you do so. He said I will take legal action once deposit is exhausted. our argument went on for some days. after that he remained silent. I called his broker and requested to settle all this amicably. But, all in vain. He messaged me on 1st october that one month rent deducted from your deposit. we had again arguments and i said if you deduct i will keep keys for a year. Finally i decided For Rs 51000 why should i loose the peace of my mind. I again contacted his broker and said that if he return agreed amount Rs 49500 then its okay or if he deduct and give than its better not to return a single penny and close the matter. i gave the keys to his broker on 2nd october. Still, he sent me a letter hand written threatening to take legal action against me and deduction of rent etc and he has done carbon copy to bank, local police station. I again called his broker and asked my he sent this letter. Broker said I don't know i have informed him i received the keys my query is 1. shall I go legal and reply through legal system 2. what should do if i want to go legal way against him 3. shall i reply in plain paper to his letter as he has sent me letter in plain paper cc to bank, police station etc 4. Is there any law protecting our rights