THE SELF DESTRUCT CAPABILITY

Every Captain has the power to destroy their vessel as an alternative to letting it be taken over by alien invaders. They can set an appropriate timexale when initiating the sequence and it can be followed with time warnings or silently so as not to alert the enemy. It can be interrupted and halted by the Captain if appropriate.

Captain Kirk threatened to implement the procedure in 2269 if his ship were commandeered by Lokai and Bele.
Then, twenty six years later, he actually followed the sequence through to completion, with no loss of Federation lives, rather then letting his vessel fall into Klingon hands.