Costa Rica (Spanish: [ˈkosta ˈrika]; literally "Rich Coast"), officially the Republic of Costa Rica (Spanish: República de Costa Rica), is a sovereign state in Central America, bordered by Nicaragua to the north, the Caribbean Sea to the northeast, Panama to the southeast, the Pacific Ocean to the southwest, and Ecuador to the south of Cocos Island. It has a population of around 5 million in a land area of 51,060 square kilometers (19,714 square miles). An estimated 333,980 people live in the capital and largest city, San José with around 2 million people in the surrounding metropolitan area. Costa Rica was sparsely inhabited by indigenous peoples before coming under Spanish rule in the 16th century. It remained a peripheral colony of the empire until independence as part of the First Mexican Empire, followed by membership in the United Provinces of Central America, from which it formally declared independence in 1847. Since then, Costa Rica has remained among the most stable, prosperous, and progressive nations in Latin America. Following the brief Costa Rican Civil War, it permanently abolished its army in 1949, becoming one of only a few sovereign nations without a standing army. The country has consistently performed favorably in the Human Development Index (HDI), placing 69th in the world as of 2015, among the highest of any Latin American nation. It has also been cited by the United Nations Development Programme (UNDP) as having attained much higher human development than other countries at the same income levels, with a better record on human development and inequality than the median of the region. Costa Rica also has progressive environmental policies. It is the only country to meet all five UNDP criteria established to measure environmental sustainability. It was ranked 42nd in the world, and third in the Americas, in the 2016 Environmental Performance Index, and was twice ranked the best performing country in the New Economics Foundation's (NEF) Happy Planet Index, which measures environmental sustainability, and was identified by the NEF as the greenest country in the world in 2009. Costa Rica plans to become a carbon-neutral country by 2021. By 2016, 98.1% of its electricity was generated from green sources particularly hydro, solar, geothermal and biomass.