Russell L. Riley chairs the Presidential Oral History Program at the University of Virginia’s Miller Center of Public Affairs and is the author of The Presidency and the Politics of Racial Inequality: Nation Keeping from 1831 to 1965.

Surely, few moments have been more somber for the Obama White House than learning that the rescue mission to extract journalist Luke Somers from Yemen had failed. The tragedy of Somers’s death at the hands of al-Qaeda was compounded by the unexpected news that a second hostage, unknown to the Americans, was also killed. That South African was reportedly just hours away from release because of a private ransom arrangement.

Presidents all the way back to George Washington have struggled with the question of hostage takers as a matter of public policy. But in recent times, the horrors of captivity have become more immediate and personal, through television and social media. How best to balance the imperatives of compassion against the realities of international relations, as well as the uncertain probabilities of rescue?

Two of President Obama’s predecessors saw their presidencies devastated over this issue. Confidential oral histories collected by the University of Virginia’s Miller Center after Jimmy Carter and Ronald Reagan left office provide evidence of the immense personal strains presidents feel when struggling with the hardship of captive Americans.

The final 444 days of Jimmy Carter’s single presidential term were devoted to securing the release of more than 60 hostages taken en masse by Iranian revolutionaries.

“No matter what else happened, it was always there,” Carter later confessed in his oral history. “It was painful because I was failing to accomplish what seemed to be a simple task to get those hostages home,” he said. “It was just an overlaying of feeling, distraught, or ill at ease, or uncomfortable. Even when we’d go to Camp David and I had a fairly relaxed weekend, I was always thinking about the hostages.”

Carter’s humanitarian preoccupation led him to political error. So committed was he to bending every effort to get the hostages back that he adopted a so-called “Rose Garden” strategy, remaining faithfully at his post in the White House until the problem was solved. The unintended consequence was that he himself became hostage to their fate.

“Once the Iranian hostage situation occurred, that dramatically changed the dynamics of everything that happened in the White House,” said Vice President Walter Mondale’s Chief of Staff Richard Moe. “Everything else got shunted aside … Nothing else, including politics, could get through the doors.”

That focus was, according to White House chief of staff Jack Watson, a mistake. “There was no way that we could have ignored it, but we shouldn’t have highlighted it by the president’s continuing stay in the Rose Garden. Every day that strategy was pursued, it gave the situation even more importance than before, if that was possible,” Watson said. All else on the president’s agenda went largely unattended.

Then there was Carter’s own failed rescue attempt — at Desert One in 1980, where a helicopter accident ended the mission — an embodiment of presidential incapacity. Carter ultimately succeeded in getting the hostages home, almost the moment his presidency ended. But he paid a huge political price in the process.

Ronald Reagan came into the White House vowing not to repeat the mistakes of the Carter years. He pointedly tried to avoid making the issue a focus of public attention. Yet after Hezbollah radicals began taking individual American hostages in Lebanon, Reagan found himself faced with the same kind of agonizing choices as Carter — to similar effect.

“It just drove [the president] crazy,” Reagan Secretary of State George Shultz reported in his oral history. “There were these hostages in Lebanon, Americans being tortured, and he couldn’t do anything about it and he’s their president … He cared about it a lot.”

White House counsel A.B. Culvahouse later recalled excruciating meetings with the hostages’ families, and brutal briefings spent listening to a three-hour tape of the CIA station chief in Beirut being beaten to death by the terrorists. “Just the little portion of that tape that I heard,” he said, “was horrific.” Defense Secretary Frank Carlucci concurred. Reagan “felt very keenly the pain of hostages,” he said. “You have to sympathize with him. He was always looking for a way to [get them] out.”

Grasping for a way to do just that, he consented to an immense and imprudent gamble: selling arms to Iran in hopes that it would then agree to help secure the hostages’ release.  Defense secretary Caspar Weinberger later claimed that the burdens of the hostages caused Reagan to abandon “all his own lifetime teachings and doctrines,” both against providing ransom and against making deals with a terrorist state. “But,” Weinberger continued, “he was so unhappy about the idea of Americans being held against their will and our being unable to pull them out that he was willing to try even this, which, he said later, was a great mistake.” When subsequent news of arms sales-for-hostages became public, along with a related diversion of some proceeds to fund anticommunist fighters in Latin America, the so-called Iran-Contra scandal nearly led to Reagan’s impeachment.

Shultz was surely right in reflecting later that “You would like to feel that if you’re an American and that’s happening to you…your President cares about it and is trying to do something about it.” Americans also have to recognize, however, that good intentions have often led to failure. History, now including the Obama experience, indicates that presidential compassion is usually unmatched by presidential capacity. Small wonder that Thomas Jefferson called the office a “splendid misery.”