Hi, your solicitor is the person to ask.
If he is on the tenancy he has the right to return as he has a right to occupy.
There is a difference depending on whether you are married or not. You are more protected if you are married. If you are not married then it may be just property rights so the deposit may be either equally split if it’s all joint or belongs to the person who paid it if that’s what has been set out in writing. Your solicitor can advise you depending on what your actual circumstances are.
Good luck sorting it out.