What is now Ecuador formed part of the northern Inca Empire until the Spanish conquest in 1533. Quito became a seat of Spanish colonial government in 1563 and part of the Viceroyalty of New Granada in 1717. The territories of the Viceroyalty - New Granada (Colombia), Venezuela, and Quito - gained their independence between 1819 and 1822 and formed a federation known as Gran Colombia. When Quito withdrew in 1830, the traditional name was changed in favor of the "Republic of the Equator." Between 1904 and 1942, Ecuador lost territories in a series of conflicts with its neighbors. A border war with Peru that flared in 1995 was resolved in 1999. Although Ecuador marked 30 years of civilian governance in 2004, the period has been marred by political instability. Protests in Quito contributed to the mid-term ouster of three of Ecuador's last four democratically elected Presidents. In September 2008, voters approved a new constitution; Ecuador's twentieth since gaining independence. General elections, under the new constitutional framework, were held in April 2009, and voters re-elected President Rafael CORREA.