The country probably takes its name from Nicarao, the leader of an indigenous community inhabiting the shores of Lake Nicaragua that was defeated in 1522 by the Spanish under Gil González de Ávila. Under Spanish rule Nicaragua was part of the captaincy general of Guatemala. After declaring independence from Spain (1821), Nicaragua was briefly part of the Mexican Empire of Agustín de Iturbide and then (1825–38) a member of the Central American Federation. Nicaraguan politics were wracked by conflict between Liberals and Conservatives, centered respectively in León and Granada; Managua was founded as the capital in 1855 as a compromise. British influence had been established along the east coast in the 17th cent., and in 1848 the British seizure of San Juan del Norte opened a period of conflict over control of the Mosquito Coast.
The United States was interested in a transisthmian canal (see Nicaragua Canal), and its interest was heightened by the discovery of gold in California. In 1851, Cornelius Vanderbilt opened a transisthmian route through Nicaragua for the gold seekers. The Clayton-Bulwer Treaty (1850) settled some of the issues between Great Britain and the United States concerning the proposed canal, but Nicaragua remained in a state of disorder that culminated in the temporary triumph (1855–57) of the filibuster William Walker.
After Walker's defeat there was a long period of quiet under Conservative control until the Liberal leader, José Santos Zelaya, became president in 1894. He instituted a vigorous dictatorship, extended Nicaraguan authority over the Mosquito Coast, promoted economic development, and interfered in the affairs of neighboring countries. His financial dealings with Britain aroused the apprehension of the United States and helped bring about his downfall (1909).
In 1912, U.S. marines were landed to support the provisional president, Adolfo Díaz, in a civil war. The Bryan-Chamorro Treaty, giving the United States exclusive rights for a Nicaraguan canal and other privileges, was ratified in 1916. (It was terminated in 1970.) The Liberals opposed the U.S. intervention, and there was guerrilla warfare against the U.S.-supported regime for years. American occupation ended in 1925 but resumed the next year, when Emiliano Chamorro attempted to seize power. Augusto César Sandino was a leader of the anti-occupation forces. The U.S. diplomat Henry L. Stimson succeeded in getting most factions to agree (1927) to binding elections, although Sandino continued to fight.
The U.S. marines were withdrawn in 1933. Three years later Anastasio Somoza emerged as the strong man in Nicaragua. He officially became president in 1937 and ruled for 20 years. In the 1947 elections a new president was chosen, but he was ousted by Somoza after less than a month in office. Nicaragua virtually became Somoza's private estate; the regime aroused much criticism among liberal groups in Latin America. Under Somoza relations with other Central American republics were poor. Somoza was assassinated in 1956, and his son Luis Somoza Debayle became president. Another son, Anastasio Somoza Debayle, headed the armed forces. The Somoza family engineered the election of René Schick Gutiérrez as president in 1963. After his death in 1966, Lorenzo Guerrero, the vice president, succeeded. Anastasio Somoza Debayle was elected president in 1967.
Although Somoza resigned from office in May, 1972, handing power to the governing council, he retained effective control of the country as head of the armed forces and leader of the NLP. After the earthquake (Dec., 1972) that devastated Managua, he became director of the emergency relief operations and diverted international aid to himself and his associates, an abuse that solidified opposition to the Somoza regime.
Somoza returned to the presidency in 1974 as objections to his regime increased. The opposition was grouped under two large factions, the Sandinista National Liberation Front (FSLN) and the Democratic Liberation Union (UDEL). Violent clashes between the Somoza government and the opposition mounted throughout the 1970s until in 1979 the FSLN and UDEL toppled the Somoza government. The more radical, left-wing FSLN (or Sandinistas) took control of the government, instituting widespread social, political, and economic changes. Many economic institutions and resources were nationalized, land was redistributed, and social services such as health care and education were improved.
In 1981 the United States, politically unsupportive of the Sandinista government and suspicious of its relations with the Soviet Union and Cuba, cut off economic aid and began supporting counterrevolutionary military forces, or contras. After the U.S. Congress acted to cut off aid to the contras, it was continued covertly (see Iran-contra affair). In 1984 the United States illegally mined Nicaragua's principal export harbors, and in 1985 it instituted a trade embargo. In 1984, under pressure, the regime held elections, in which the junta leader, Daniel Ortega Saavedra, was chosen president. The Sandinista government was popular especially with the peasants and the urban poor. Although it received substantial Soviet aid, it was increasingly unable to maintain the economy, and it curtailed civil liberties to silence dissent.
In the Feb., 1990, elections, held under a Central American peace initiative, the FSLN was defeated by an opposition coalition, and Violeta Barrios de Chamorro, a political moderate, became president. The United States subsequently lifted its trade embargo, and the contras ceased fighting. Chamorro sought, with mixed success, to revive the economy and generate a conciliatory political environment; tense relations between the Sandinistas and their opponents at times threatened to undermine her government.
Ortega ran for president again in 1996, but was defeated by José Arnoldo Alemán Lacayo, leader of the Liberal Alliance, a conservative coalition. The country was devastated by Hurricane Mitch in Nov., 1998, which killed 4,000 people, including over 1,500 buried in a mudslide when the Casita volcano collapsed; much of the country's agricultural land and infrastructure were destroyed. The Liberal party retained the presidency in the 2001 elections as Enrique Bolaños Geyer defeated Daniel Ortega.
Bolaños launched an anticorruption campaign that led (2003) to the conviction of his predecessor for embezzlement and other crimes. The move against Alemán, who was jailed but later released to detention at his farm, led to a power struggle in 2004 between Liberal party members in the national assembly, who formed an alliance with the Sandinistas, and President Bolaños. Legislators attempted to pass constitutional amendments curtailing the president's powers and attempted to force him from office. An accord ending the dispute was negotiated in Jan., 2005, but legislators subsequently passed the amendments, which the administration has ignored despite rulings from the supreme court (largely appointed by the Sandinistas). The power struggle effectively paralyzed the government.
In July, 2005, the president's opponents initiated impeachment proceedings, but in October Bolaños and Ortega reached an agreement that would delay the constitutional changes until 2007, after Bolaños had left office, and the legislature subsequently approved the move. In the Nov., 2006, presidential election, Ortega was elected president; the campaign was a three-way race in which the center-right vote was split between two candidates. In Mar., 2007, in a move that was seen by many observers as part of a deal between Ortega and former president Alemán, Alemán's house arrest was essentially ended.
In May, 2008, a number of opposition parties were stripped of their legal standing, including the Sandinista Renovation Movement and the Conservative party. The move was regarded by many as an attempt by the Sandinistas (FSLN) and Liberals to limit voters alternatives in the November local elections. The elections were largely won by the FSLN but criticized internationally for the absence of international observers and disputed by the Liberals; they were also marred by pre- and post-voting violence in which Sandinista partisans played the dominant role. The supreme court overturned former President Alemán's conviction for money laundering in Jan., 2009, as part of an apparent pact between the Liberals and Sandinistas that also led to the election of a Sandinista as National Assembly president.
After Ortega failed to win passage of a constitutional amendment that would permit him to run for reelection, a supreme court panel composed entirely of Sandinista judges ruled (Oct., 2009) that the constitutional bans on a president serving consecutive terms and more than two terms were unenforceable. The National Assembly later opposed (December) the decision, calling on the electoral commission to determine the matter, and leading to contention over the appointment of new commission members and subsequently new supreme court members, with Ortega attempting to extend the expired terms of sitting members by decree. The constitutional crisis continued into 2010, and in Aug., 2010, Ortega supporters on the supreme court moved to replace boycotting opposition-aligned justices with Sandinista lawyers. In Jan., 2010, an appeals court reopened several corruption cases again Alemán, who had indicated that he planned to run for president in 2011.
Tensions flared with Costa Rica in late 2010 over a disputed island at the San Juan River's mouth when Nicaraguan troops were sent there; Nicaragua did not remove its forces after the Organization of American States called for both sides to withdraw and negotiate. Costa Rica brought the issue before the International Court of Justice; a 2011 interim ruling called on both sides to avoid the disputed area. Ortega was reelected in Nov., 2011, by a landslide that also led to a Sandinista majority in the National Assembly. Aspects of the election, including the lack of independence on the part of the electoral council, were criticized by some international observers. In Nov., 2012, the FSLN again dominated the local elections, leading to protests and violent clashes in some areas.