African Americans did not have the legal right to vote until the passage of the 15th amendment to the Constitution in 1870. However, the rights declared in that amendment were not protected or enforced until the passage of the Voting Rights Act of 1965.
Between the passage of the 15th amendment and the Voting Rights Act of 1965, many southern states prevented African Americans from voting through the use of poll taxes, literacy tests or grandfather clauses, which stated that a person could vote only if his grandfather was allowed to vote. The federal government could not address this issue, as it was a state matter to decide voting qualifications.
The Voting Rights Act of 1965 was signed by President Lyndon Johnson after increasing pressure from the Civil Rights community including the Southern Christian Leadership Conference and the Student Nonviolent Coordinating Committee. After protests in Selma, Alabama by Martin Luther King Jr. and Malcolm X, as well as the famous Selma to Montgomery Marches, the president brought the issue of voting rights before congress, which, in a bipartisan bill, supported the cause.