A quagmire is something else - it is when the withdrawal is not longer possible without significant cost! A quagmire is a soft wet area of low-lying land that sinks underfoot and which is difficult to extricate from. Afghanistan was a quagmire for Soviets - their withdrawal undermined their government. Algeria was a quagmire for French - it led to the constitutional crisis in France.
There will be significant costs whether you stay or leave. You must choose the lesser of two evils, which is withdrawal if there is no hope of achieving the objectives you originally tried to achieve. No sense becoming bogged down indefinitely lossing lives and national treasure.