Owner not returning my rent deposit

Hello Sir, I had rented a flat for 7 years. Initially, we had created the agreement but our relationship improved so we didn't bother to get the new agreement. I have the xerox copy of the agreement and all the bills we paid for that house like electricity, telephone. Just 7 months back, we had to empty his house as he was going to sell his house. So we moved to new house. We kept requesting him for the deposit for 7 months, but he kept telling us he has no money. So as we had a good relationship with him for 7 years, we didn't force him. Just 15 days back he had sold his house and we requested him, but he still is saying he has no money. But the deposit amount is a fraction of what he had sold the house for. As the owner was staying in another city, he had told us to keep the keys. But just a couple of days before he threated us to give the keys to the new owner or else he will complain to the police. I told him that I will give the keys as soon as I get my deposit. But he started threating us on phone telling us he will take serious action on me. So I gave the keys to the new owner as I didn't want police on my doorstep. So please suggest me how to get my deposit back legally from him. I have the agreement xerox