@Sergio Aguinaga you will need to check with an attorney in your state to get a definitive answer, but if you in the eviction case you will most likely be allowed to keep the security deposit. You are in a safer position keeping a security deposit to cover back rent than you are to cover damage in most cases, as tenants can more easily challenge damages.
@Sergio Aguinaga talk to a local realtor and ask them. I have several attorneys I work with regularly here in the Chicago area who would give you a quick email answer for free. I am sure your local investor friendly agents will be able to find the same contact there.
@Sergio Aguinaga if you are in eviction court you should be able to keep the security deposit. In most cases, this is covering lost rent. Obviously, consult your local attorney on this though.