The year was 1862. America was in the depths of the Civil War.

Looking back, it’s easy to believe that a Union victory was inevitable. The North had more money, more population, more industry. But no one thought that at the time. In the first year of the war, it looked as if the South would win. A series of high-profile victories in the east convinced many that Confederates were better fighters, under better leaders.

Where would President Lincoln find a battlefield general who could do for the Union what Robert E. Lee was doing for the Confederacy—lead it to victory?

The man he found, the man who saved the Union, was Ulysses S. Grant. He wasn’t Lincoln’s first choice—or second, or third. In fact, when the war started in 1861, Lincoln had no idea who Ulysses S. Grant was. Hardly surprising since, at the time, Grant was selling hats to farmers’ wives in a small town in Illinois.

His rise to glory is one of the most amazing stories in American history.

Born in Ohio on April 27, 1822, Grant had no ambition to be a soldier. His father pushed him into it, thinking he wasn’t suited for much else. Grant’s West Point career wasn’t especially distinguished, either. But during the Mexican-American War (1846-1848), Grant proved himself to be an officer of unusual ability. He was cool under fire, daring, but rarely reckless. Even more important, the men under his command trusted him.

After that war, Grant returned to St. Louis to marry his fiancée, Julia Dent, the daughter of a slave-owning Missouri farmer. Grant was never happier than when he was with Julia. And he was never unhappier than when he was not. Unfortunately, in this period, Army life forced them to be separated—sometimes for many months.

To assuage his loneliness, Grant started to drink. While in a distant posting in northern California, a thousand miles from Julia, his drinking got the better of him. He resigned his Army commission to avoid an embarrassing court-martial.

It was downhill from there, one business venture failing after another. By 1860, thoroughly humiliated and with no money and no prospects, he was back working for his father in the small town of Galena, Illinois.

Then, the Civil War happened.

The Union was in desperate need of experienced soldiers. Grant volunteered. His leadership skills were immediately obvious. He quickly advanced through the ranks.

In a little more than six months, he scored two major victories at Fort Henry and Fort Donelson, along the Tennessee and Cumberland rivers. He followed these up with victory in the largest battle in American history up to that time—the Battle of Shiloh—making him a true Union hero in a cause that was starved for heroes.

There was nothing flashy about Grant’s generalship. All he did was win.

Unlike the overly-cautious generals that drove President Lincoln to distraction, Grant’s battle plan was to always move forward, always put pressure on his foes. Any advantage the Union had in technology or manpower he employed to the fullest.

Like Napoleon, Grant was a superb reader of maps. He could identify the enemy’s vulnerabilities and exploit them, as he did in his brilliant 1863 Campaign for Vicksburg—a campaign that is still studied at war colleges.

In March 1864, Lincoln made Grant commander of all the Union armies. It took more than a year of the war’s hardest fighting before Lee surrendered and the war finally came to an end.

By this point the president and his general had developed a close bond. Shortly after Grant returned to Washington, Lincoln invited the Grants to join him and Mary Lincoln at Ford’s Theatre. Grant accepted. Julia, however, had developed an intense dislike for Mary Lincoln and insisted that her husband get out of the commitment. Embarrassed, Grant did.

That night, in that theatre, Lincoln was assassinated.

As the commander of all Union armies, Grant was placed in a terrible bind, having to walk a tightrope between new president Andrew Johnson’s pro-South agenda, which favored the old white aristocracy, and protecting, as Lincoln intended, the newly-won rights of the freed slaves.

Grant had saved America once as a general. Could he save it again as a politician?

Running as the Republican candidate for president, Grant easily won election in 1868, and then again, in 1872.

During his tenure, he fought to secure the passage of the 15th Amendment, which guaranteed all American citizens the right to vote, regardless of “race, color, or previous condition of servitude.”

He created the Department of Justice, broke up the Ku Klux Klan, and advocated for the rights of Indians.

He presided over the completion of the transcontinental railroad and a rapidly expanding industrial economy.

But Grant wasn’t done.

One week before his death on July 23, 1885, he completed his autobiography. It became one of the best-selling books of the 19th century.

Of Grant’s amazing life, Frederick Douglass wrote a fitting epithet: “In him, the negro found a protector, the Indian a friend, a vanquished foe a brother, an imperiled nation a savior.”

I’m Garry Adelman, director of history and education at The Civil War Trust, for Prager University.