At the end of a historic two-month trial, the U.S. Senate narrowly fails to convict President Andrew Johnson of the impeachment charges levied against him by the House of Representatives three months earlier. The senators voted 35 guilty and 19 not guilty on the second article of impeachment, a charge related to his violation of the Tenure of Office Act in the previous year. Ten days earlier, the Senate had likewise failed to convict Johnson on another article of impeachment, the 11th, voting an identical 35 for conviction and 19 for acquittal. Because both votes fell short–by one vote–of the two-thirds majority needed to convict Johnson, he was judged not guilty and remained in office.

READ MORE: How Many US Presidents Have Faced Impeachment?

At the outbreak of the Civil War in 1861, Johnson, a U.S. senator from Tennessee, was the only senator from a seceding state who remained loyal to the Union. Johnson’s political career was built on his defense of the interests of poor white Southerners against the landed classes; of his decision to oppose secession, he said, “Damn the negroes; I am fighting those traitorous aristocrats, their masters.” For his loyalty, President Abraham Lincoln appointed him military governor of Tennessee in 1862, and in 1864 Johnson was elected vice president of the United States.

Sworn in as president after Lincoln’s assassination in April 1865, President Johnson enacted a lenient Reconstruction policy for the defeated South, including almost total amnesty to ex-Confederates, a program of rapid restoration of U.S.-state status for the seceded states, and the approval of new, local Southern governments, which were able to legislate “black codes” that preserved the system of slavery in all but name. The Republican-dominated Congress greatly opposed Johnson’s Reconstruction program and passed the “Radical Reconstruction” by repeatedly overriding the president’s vetoes. Under the Radical Reconstruction, local Southern governments gave way to federal military rule, and African American men in the South were granted the constitutional right to vote.

In March 1867, in order to weaken further Johnson’s authority, Congress passed the Tenure of Office Act over his veto. The act prohibited the president from removing federal office holders, including cabinet members, who had been confirmed by the Senate, without the consent of the Senate. It was designed to shield members of Johnson’s cabinet, like Secretary of War Edwin M. Stanton, who was appointed during the Lincoln administration and was a leading ally of the so-called Radical Republicans in Congress. In the fall of 1867, Johnson attempted to test the constitutionality of the act by replacing Stanton with General Ulysses S. Grant. However, the U.S. Supreme Court refused to rule on the case, and Grant turned the office back to Stanton after the Senate passed a measure in protest of the dismissal.

On February 21, 1868, Johnson decided to rid himself of Stanton once and for all and appointed General Lorenzo Thomas, an individual far less favorable to the Congress than Grant, as secretary of war. Stanton refused to yield, barricading himself in his office, and the House of Representatives, which had already discussed impeachment after Johnson’s first dismissal of Stanton, initiated formal impeachment proceedings against the president. On February 24, the House voted 11 impeachment articles against President Johnson. Nine of the articles cited his violations of the Tenure of Office Act; one cited his opposition to the Army Appropriations Act of 1867 (designed to deprive the president of his constitutional position as commander in chief of the U.S. Army); and one accused Johnson of bringing “into disgrace, ridicule, hatred, contempt, and reproach the Congress of the United States” through certain controversial speeches.

On March 13, according to the rules set out in Section 3 of Article I of the U.S. Constitution, the impeachment trial of President Johnson began in the Senate. U.S. Supreme Court Chief Justice Salmon P. Chase presided over the proceedings, which were described as theatrical. On May 16 and again on May 26, the Senate voted on the charges brought against President Johnson. Both times the vote was 35 for conviction and 19 for acquittal, with seven moderate Republicans joining 12 Democrats in voting against what was a weak case for impeachment. The vote fell just short of a two-thirds majority, and Johnson remained in office. Nevertheless, he chose not to seek reelection on the Democratic ticket. In November, Ulysses S. Grant, who supported the Republicans’ Radical Reconstruction policies, was elected president of the United States.

In 1875, after two failed bids, Johnson won reelection to Congress as a U.S. senator from Tennessee. He died less than four months after taking office, at the age of 66. Fifty-one years later, the U.S. Supreme Court declared the Tenure of Office Act unconstitutional in its ruling in Myers v. United States.

READ MORE: What Happens in a Senate Impeachment Trial?