What you are describing as one sum actually falls under two. We have to divide the two and discuss each separately.
Damage to carpet
The landlord is allowed to keep any amount of the deposit reasonably necessary to get the property to its shape prior to the rental minus normal wear and tear under Tex. Prop. Code Sec. 92.101 et seq. What "wear and tear" means is subjective, as is what amount of amount the landlord withholds. It is presumed that the amount is valid, but if it is exaggerated, or not needed, the tenant can challenge this in small claims court (Justice of the Peace Court in Texas), and let the Judge decide. It often becomes the landlord's word over the ex-tenant's, and this is why it is a good idea to tape/photograph the apartment prior to leaving, so that one would have extra proof aside from the testimony. Since no visual record is available, the Court would have to go off whoever seems more believable.
The presumption is that the withholding is valid. It is up to the ex-tenant to file in court (or threaten to do so) to get the money back.
Breach of lease
Let me be honest with you - it sounds like someone in your situation did breach the lease without cause under Texas law. If so, then the landlord can (a) demand money per pre-agreed sum in the lease, and/or, (b) sue/demand money for the breach of the lease. Out of this, part (b) becomes subjective. It is presumed that the ex-tenant is liable for the full remaining time of the lease. However, the ex-tenant can sue in Court to minimize that amount on two principles:
1) If the landlord re-rented, then they can only collect for the time the property stood empty before the breached lease's end date. In other words, if the landlord already got paid the same amount by another tenant that moved in, they cannot "double-dip" to demand damages from the ex-tenant for that time;
2) The landlord is expected to mitigate damages. This means reasonably attempt to re-rent the property. If they do not, then the ex-tenant can seek to minimize (but not to completely void) the breach of the lease liability, at the discretion of the Judge.
Again, this involves going to JP Court. The ex-tenant can attack both the deposit and the breach of lease issues under one case.
I hope this helps and clarifies. Please use the SEND or REPLY button to keep chatting, or please RATE when finished. You may always ask follow ups at no charge after rating. Kindly rate my answer as one of TOP THREE FACES/STARS and then SUBMIT, as this is how experts get credit for our time. Rating my answer the bottom two faces/stars (or failing to submit the rating) does not give me credit and reflects poorly on me, even if my answer is correct. I work very hard to formulate an informative and honest answer for you; please reciprocate my good faith with a positive rating.