Starting in the early 20th century, the U.S. enacted its plan of "Dollar Diplomacy" in Latin American countries. Using dollar diplomacy, the U.S. issued loans to Nicaragua in exchange for essentially choosing the president. Despite this, in 1912, the U.S. started a military occupation in Nicaragua with the goal of protecting U.S. economic interests.
In 1921, a rebellion started in Nicaragua to end U.S. intervention. To resolve this conflict, the U.S. formed a pact with Nicaragua in 1927 to supervise elections and establish a National Guard as the sole military force. The only revolutionary left after this pact was a man named Augusto Sandino, the man which the Sandinista Movement (FSLN) was named after. Sandino mobilized Segovia’s peasantry for a 6 year guerilla warfare operation, eventually managing to end the U.S. occupation of Nicaragua in 1933. Sandino was then assassinated by the National Guard on Feb. 21, 1934 despite a surrender agreement. Afterwards, Anastasio Somoza was brought to power in 1936 with the assistance of the National Guard, which continued to maintain the Somoza family’s rule for the next 43 years.
The FSLN started out as a small-scale rebellion against the Somoza family's autocratic rule with a few dozen members in the early 1960s after being inspired by the Cuban revolution. They used similar paramilitary tactics as Sandino and appealed to the rural poor, but added their own elements of mass-based urban insurgency and slightly Marxist ideology.

Photograph of Augusto César Sandino
Wikipedia Commons