This paper proposes integrating a Unified Power Quality Controller (UPQC) with a distributed generator (DG). The UPQC consists of series and shunt inverters connected to a common DC link, and can compensate for power quality issues like voltage sags/swells, harmonics, and reactive power. Integrating a DG connected through a rectifier to the DC link allows the system to operate in two modes: interconnected mode where the DG supplies power to the source and load, and islanding mode where the DG only supplies the load during a source voltage interruption. Simulations show the integrated system can compensate for voltage sags and swells in both forward and reverse power flow modes between the DG and