This paper presents a pilot protection algorithm for alternating (ac) and direct current (dc) transmission lines, the last in the line commutated converter and voltage source converter topologies. The main contribution of this research lies, in this context, in the development of a protection method for lines of different natures. This method relies on the dynamic time warping (DTW) technique. The solution is attractive as it does not require any line or system parameters and works only with current samples. For ac lines, the algorithm uses DTW to evaluate the line terminals phase currents' and the zero-sequence components' similarities and detect faults. In turn, for dc lines, the method employs DTW technique to evaluate the similarities of cross-currents between poles and terminals and identify internal dc faults. The authors tested the algorithm for each line topology through several fault simulations, also considering the challenging conditions of high impedance internal faults, sampled noises, misalignment between samples, current transformer saturation, power swing, and internal fault with outfeed. This solution was also tested against field-recorded data in existing lines, and the resulting trip times were compared with the ones of the actual protection devices. All results indicate that this solution yields a rapid, effective, secure, and dependable protection.INDEX TERMS Power transmission lines, line commutated converter, voltage source converter, pilot protection, dynamic time warping.