Operation of power system within specified limits of voltage and frequency are the major concerns in power system stability studies. As power system is always prone to disturbances, which consequently affect the voltage instability and optimal power flow, and therefore risks the power systems stability and security. In this paper, a novel technique based on the “Artificial Algae Algorithm” (AAA) is introduced, to identify the optimal location and the parameters setting of Unified Power Flow Controller (UPFC) under N-1 contingency criterion. In the first part, we have carried out a contingency operation and ranking process for the most parlous lines outage contingencies while taking the transmission lines overloading (NOLL) and voltage violation of buses (NVVB) as a performance parameter (PP = NOLL + NVVB). As UPFC possesses too much prohibitive cost and larger size, its optimal location and size must be identified before the actual deployment. In the second part, we have applied a novel AAA technique to identify the optimal location and parameters setting of UPFC under the discovered contingencies. The simulations have been executed on IEEE 14 bus and 30 bus networks. The results reveals that the location of UPFC is significantly optimized using AAA technique, which has improved the stability and security of the power system by curtailing the overloaded transmission lines and limiting the voltage violations of buses.