We consider the problem of distributed and secure routing for target tracking in wireless sensor networks (WSN) based on quantized sensors measurements. We propose a new method for jointly selecting the optimal communication path between slave sensors and cluster head (CH), detecting the malicious sensors and estimating the target position. Firstly, we detect the malicious sensor nodes based on the information relevance of their measurements. Secondly, we select the optimal communication route in order to balance the energy dissipation and to provide the required data of the target in the WSN. This selection is also based on the transmission power between a sensor node and a cluster head. Then, we estimate the target position using Quantized Variational Filtering (QVF) algorithm. The computation of these criteria is based on the target position predictive distribution provided by the QVF algorithm. The performance of the proposed method is validated by simulation results in target tracking for WSN.