This paper proposes a phase detection method for harmonics and unbalanced voltage conditions. The proposed method uses harmonics and unbalanced voltage compensation circuit in addition to basic PLL (Phase Locked Loop) circuit. In the harmonic compensation circuit, the harmonic voltage component are eliminated from the input voltages using specific harmonic detection method. Besides, frequency information of power system used in the specific harmonic detection method is estimated by an extended complex Kalman filter. In the unbalanced voltage compensation circuit, the input voltage is normalized after the calculated positive sequence component. By means of the proposed method, excellent phase detection performance can be achieved under harmonics and unbalanced voltage conditions. Moreover, detection of positive sequence voltage component becomes possible under voltage drop conditions due to faults in power systems. The effectiveness of the proposed method is verified by simulation results.