There are a lot of presidential firsts out there. Some are rather charming, like the first president to enjoy electricity in the White House (Benjamin Harrison, who was scared to touch the light switch) and the first to ride in a car (William McKinley). Then there are the not-so-quaint trendsetters, like Andrew Johnson—the first to be impeached.

Johnson ascended to the presidency after Abraham Lincoln was assassinated in 1865. A former senator from Tennessee, he was in favor of going easy on the states that had seceded from the Union during the Civil War. Johnson gave almost total amnesty to former Confederates, supported bringing the seceded states back to the Union quickly and easily, and approved local Southern governments that passed harshly restrictive "Black Codes." Though it may seem like Johnson was favoring the Southern states due to his own heritage, in reality, he was largely following Lincoln’s plans.

In addition to being unhappy with this Reconstruction program, the “Radical Republican” majority in Congress—who were devoted to ensuring the rights of freed slaves—worried that Johnson would replace Lincoln’s cabinet with officials who would support his views. To prevent this, they passed the Tenure of Office Act, which prevented the president from firing Senate-confirmed officials without Senate approval. (The president could suspend a cabinet member while the Senate was in recess, but when the Senate reconvened, they had to sanction the removal. If they didn’t, the cabinet member was reinstated.)

Believing the Tenure of Office Act to be unconstitutional, Johnson started testing the waters. In 1867, while Congress was out of session, he suspended Lincoln’s Secretary of War, Edwin Stanton (the only Cabinet member to support the Radical Republicans). Johnson appointed Ulysses S. Grant as interim replacement—a choice he thought would appease everyone. He was wrong. The Senate didn’t sanction Stanton’s removal, returning him to the position of Secretary of War. In retaliation, Johnson formally removed Stanton and replaced him again, this time with Adjutant-General Lorenzo Thomas.

As you might suspect, this didn’t fly. Stanton refused to go, actually barricading himself in his office. On February 24, 1868, Congress initiated Johnson's impeachment process in the House, citing the president’s blatant disregard for the Tenure of Office Act, among other things. But removing a president from office requires several steps: a formal accusation from the House (the impeachment) followed by a trial and conviction from the Senate. In the end, Johnson escaped by the skin of his teeth: One more vote in the Senate and he would have been ousted.

Even though he made it through the trial, Johnson found himself booted from the White House in the months to come anyway—an unpopular incumbent, he didn’t even win the Democratic party’s nomination that year (although he had been elected with Lincoln on the National Union ticket, Johnson sought reelection as a Democrat). Instead, the Democrats nominated former governor of New York Horatio Seymour, who lost to Republican Ulysses S. Grant in the general election by a landslide.

History is actually on Johnson’s side, at least in one sense. The Tenure of Office Act was soon repealed, and ruling on a related case in 1926, the Supreme Court declared that the Tenure of Office Act was unconstitutional—just like Johnson claimed.