Needle identification in transrectal ultrasound (TRUS) guided prostate biopsy is important for documenting the positions of tissue samples, which can help physicians reach missed tumors in repeated biopsies. Due to the inherent high signal-to-noise ratio of ultrasound and the frequent occurrence of out-of-plane needle insertions that present indistinctly on TRUS images, robust needle identification is difficult. In this paper, we describe a novel method for the automatic detection and distance measurement of biopsy needles in TRUS that uses the concept of support vector machines (SVMs). Recorded frames are first retrospectively analyzed based on a series of quantifiable characteristics, and then a set of training examples are formed from both frames with insertions and those without. Using the training set, our algorithm is able to determine whether a given prospective frame contains a needle insertion. The algorithm has been evaluated retrospectively on TRUS video data with a total of more than 95,000 frames, and detected needle deployments with sensitivity and specificity of 98.4% and >99:9%, respectively. Furthermore, given the nature of an SVM model, the algorithm can be easily adapted for real-time applications.