Imagine someone wants to hand you a bag of animal-generated fertilizing agent. For some reason you agree to this. They set the bag on fire and throw it at you. Then they’re disappointed with your response. Also, they wonder if you’re gay.

You begin to understand the plight of James Buchanan. Our bachelor buddy sits atop the scrap heap, decreed by legions of historians to be the worst president ever. He’s last in most surveys of presidential awesomeness and next-to-last in the rest. As far as your public school education is concerned, he’s the man who sat on his hands as states peeled away from the Union; a Pennsylvanian who tolerated slavery; the yin that makes Lincoln into such a huge yang.

Which isn’t such a bad thing for Wheatland, Buchanan’s Lancaster estate. “It helps us market this place,” says Patrick Clarke, the home’s director, with a chuckle. But the home looks like a setting from a success story: the ceilings are high, the furniture is elegant and the colors are bright. There’s an atmosphere of wealth and dignity. Seeing Buchanan’s writing desk in a beam of sunlight, the mansion seems livable and warm, not like the bizarro Fortress of Solitude where he scribbled memoirs no one wanted to read. In a nation divided, it was agreed that no one liked James Buchanan. Could he really be that bad?

Let’s see. He was born in 1791 to Irish immigrants, the second of 11 middle-class siblings. You’d probably want to hang out with him—he chomped cigars, drank the best whiskey, loved to gossip and was briefly kicked out of college for the 19th-century equivalent of partying. He was arrogant and occasionally whiny, but he had a sharp mind. Clarke calls him “a very efficient man—very detail oriented.” Those qualities made him a great lawyer, and being a great lawyer made into Rich Uncle Pennybags. He was able to send 22 nieces and nephews through school, buy some very nice houses and keep them stocked with high-end booze.

Politics was more of a passion than an income. Starting in 1821 he was a Representative, a Senator, a diplomat to Russia and England, and secretary of State—maybe the most impressive governmental resume of any president. Buchanan seldom astonished, but his connections and his ability to carefully assemble rock-solid logical arguments—lawyering—made him a useful Democratic mule for 35 years. He was the reliable nerd that jocks like Jackson and Polk would keep around to help with homework. Then, after decades of sacrifice and competent public service, when he finally achieved the office he had hoped for in 1844, 1848 and 1852, he apparently became a national disgrace.

It doesn’t add up.

So think about the context. “I tremble for my country when I reflect that God is just: that his justice cannot sleep forever.” Thomas Jefferson wrote that about slavery in 1782, seven years before the Constitution and 79 years before God woke up on Buchanan’s watch. The architects built the system knowing that slavery could one day make it fail.

That day was approaching by the 1850s. Millard Fillmore (37th in C-SPAN’s rankings) and Franklin Pierce (40th) had pretty much crapped the bed, contributing nothing to a long-term solution. Slavery was expanding with the country, and people on both sides of the crusade were getting increasingly pissed; armed conflict and grisly murders in Kansas hinted at things to come. The dispute tore apart the Democratic Party and gave birth to the Republican Party, so Congress was a mess. “Buchanan had a rough hand to deal with” in 1857, Clarke says, which is like saying Lincoln had a slight head wound problem in 1865.

To be fair, he didn’t play his hand well. With the country fissured on a moral line, the cautious Buchanan figured that the situation called for… lawyering. Needing an ace, he threw down “Rules of Draw and Stud Poker.” James put his energy into negotiating rational resolutions under the law—amending the Constitution, or reinforcing Southern property rights, or legally forcing Northerners and Southerners to hug and be friends. His hope was to brace the country with a legal frame, everyone grudgingly respecting the rules until slavery was gradually wiped out by public outrage and economic realities (plantations ain’t cheap). “Instead of being commander-in-chief, he’s a commanding diplomat,” Clarke says. But the passions were already Middle-East hot. If you run into the middle of a knife fight shouting “let’s be reasonable,” you’re going to get stabbed. Front and back.

But what could he have done, exactly? If you think a war might destroy the greatest experiment in democracy, how could you start it? How do you cure a disease that had been festering for years? He was Irish, not a magical leprechaun.

Buchanan’s crime, the offense that made him the “worst president ever,” was his failure to be the best president ever. Like every man before him, he couldn’t untie the Gordian knot. Lincoln, on the other hand, began with a great gift: South Carolina graciously popped off and started the war for him, giving him the moral authority to pick up a sword and start hacking.

Let’s tally it up. James Buchanan was tentative and uncreative. His strengths were nullified by circumstance, and so he was not great at his job. But he tried his best against impossible odds. He also had a very nice home, and a fine eye for decorating. Call him bad if you want, but he’s not the worst.

Which means someone else goes under the bus. Asked for a replacement, Clarke laughs. “I always have a hard time judging these guys because I see so many sides of them,” he says. Pressed by an annoyingly persistent questioner, he plays along. “You know, Tyler didn’t do such a hot job.”

John Tyler: history’s greatest monster. You read it here first.

As to the gay question, we’re getting there. Be patient.