Nicaragua is striving to overcome the after-effects of dictatorship, civil war and natural calamities, which have left it one of the poorest countries in the Western Hemisphere.
It is now also struggling with the conflict associated with being on the drug trafficking route to the United States.
Nicaragua has traditionally relied on agricultural exports to sustain its economy but the country's meagre national wealth benefited mainly a few elite families of Spanish descent, in particular the Somoza family in the mid-20th century. This dynasty ruled the country with US backing between 1937 and the Sandinista revolution in 1979.
The Sandinistas began redistributing property and made huge progress in the spheres of health and education, but the US launched a sustained campaign of embargoes and armed subversion.
It is now hoping to launch one of the world's most ambitious infrastructure schemes - a canal project to rival the Panama Canal.
Republic of Nicaragua
Population 5.9 million
Area 120,254 sq km (46,430 sq miles)
Major languages Spanish, English, indigenous languages
Major religion Christianity
Life expectancy 71 years (men), 77 years (women)
Currency gold cordoba
President: Daniel Ortega
Left-wing Sandinista leader Daniel Ortega made his political comeback in the November 2006 elections, having led Nicaragua through revolution and a civil war before being voted out in 1990.
He cruised to victory in the 2016 presidential election to win a third consecutive five-year term. His wife Rosario Murillo won the position of vice-president.
Independent election observers, as well as opposition figures and the US voiced deep concern about the fairness of the poll.
Mr Ortega's opponents have accused the former fighter of seeking to consolidate his family's control over Nicaraguan politics by appointing relatives to key posts and side-lining opposition candidates.
In 2014, his Sandinista National Liberation Front (FSLN) pushed constitutional changes through Congress eliminating presidential terms limits.
Mr Ortega has strong support from the country's poor who account for more than a third of the population and have benefitted from his social programmes.
During his tenure, Nicaragua has experienced stable economic growth, poverty levels have fallen and low violence compared to elsewhere in Central America.
However, he faced violent unrest in mid-2018 which was initially triggered by now-aborted reforms to the near-bankrupt social security system.
Radio and TV are the main sources of news. There are more than 100 radio stations and several TV networks.
Media freedom group Reporters Without Borders says journalists face harassment, arbitrary arrest and death threats.
Some key dates in Nicaragua's history:
1838 - Nicaragua becomes fully independent. Country spends most of the 19th century in violent power struggles between Liberal and Conservative factions.
1860 - British cede control over the country's Caribbean coast to Nicaragua.
1909 - US supports a coup by Nicaragua's conservative forces, beginning a long period of US interventions and occupations in Nicaragua.
1927 - National hero Cesar Augusto Sandino begins a rebellion against the US occupiers and their Nicaraguan allies.
1934 - Sandino forces the US marines to withdraw. Sandino is assassinated. Anastasio Somoza Garcia, at the head of the National Guard, installs the Somoza family dynasty. Somoza and his sons Luis and Anastasio Jr rule Nicaragua until 1979.
1978 - Assassination of opposition leader Pedro Joaquin Chamorro triggers general strike and unites moderates and the Sandinista National Liberation Front (FSLN) in efforts to oust Somoza.
1979 - Sandanista military offensive ends with the ouster of Somoza. National reconstruction government is formed under Sandinista leader Daniel Ortega. Left-wing stance of Sandinista leaders results in formation of anti-Sandinista rebels, the Contras.
1984 - Daniel Ortega is elected president. The US government led by President Ronald Reagan backs the Contras with arms and money, escalating the armed conflict.
Inflation reaches 33,000% in 1988 and GDP plunges 13.6%. Central American presidents step in and broker a peace settlement. The US disarms the Contras in return for guarantees of a fair election.
1990 - Violeta Barrios de Chamorro leads an anti-Sandinista coalition to defeat Daniel Ortega and is elected president. She installs a national reconciliation government, the war ends and the economy gradually starts to recover.
2006 - Ex-president Daniel Ortega is returned to power in elections.