History has been kind to Jimmy Carter in a way the present never was during his one term as US president.
His four years were dogged by economic "stagflation", which began during the term of his predecessor Richard Nixon, and America's stumbles on foreign policy.
The surprise 1980 landslide loss to Ronald Reagan was deemed a referendum on Carter's leadership.
Voters had daily reminders that their commander in chief was unable to free the dozens of Americans held captive in an embassy in the Iranian capital, Tehran.
The enduring myth that Carter failed to act was strengthened by the fact the release of the hostages came after his departure from the White House.
But when the crisis began 444 days earlier, no-one could have anticipated how long it would last, and how it would shape American politics.
The fall of the Shah of Iran
The seeds of the hostage crisis were planted in the chaos of Iran's Islamic Revolution.
Iran and the United States had been on friendly terms while Mohammad Reza Pahlavi was the Shah of Iran — the country's royal ruler.
The Shah came to the throne in Tehran during World War II and his power in the oil-rich country was shored up in the 1950s after the US and UK backed a coup to depose the country's democratically elected prime minister.
Carter hosted a state dinner for the Shah and his wife at the White House in November 1977 and, in turn, the Shah entertained Carter in Tehran on New Year's Day in 1978.
But over the ensuing year, the Shah faced violent unrest at home as religious leader Ayatollah Khomeini returned from exile to overthrow the autocrat.
The Shah fled to Egypt on January 16, 1979, and a month later the government collapsed.
In October, the Shah arrived in New York to undergo surgery, angering Khomeini and his supporters, who demanded he be returned to stand trial.
Khomeini called for a "purge" of "American-loving rotten brains", and encouraged activist students to "expand their attacks" against the US and Israel, America's major ally in the Middle East.
The 52 hostages
On November 4, 1979, hundreds of Iranian students breached the gates of the US embassy in Tehran.
They quickly occupied the compound. Some had intended a peaceful sit-in, but the situation deteriorated rapidly.
The armed mob took 66 Americans hostage.
Consular employee Robert C Ode, who at 65 was the oldest person taken captive, recalled in his diary that the students tied his hands behind his back so tightly with nylon cord that it cut off the circulation.
I strongly protested the violation of my diplomatic immunity, but these protests were ignored.
Some students attempted to talk with us, stating how they didn't hate Americans — only our US government, President Carter, etc.
We were not permitted to talk to our fellow hostages and from then on our hands were tied day and night and only removed while we were eating or had to go to the bathroom.
Six American diplomats were able to avoid capture and spent three months hiding in the Canadian and Swedish embassies — their rescue would later be the plot of the 2012 movie Argo.
About the same time as the US embassy was occupied, the British embassy was also stormed by Iranian students, but they left after several hours.
Khomeini condoned the occupation of the embassies, threatening to do "whatever is necessary" to bring the Shah back for trial and force Britain to hand over exiled prime minister Shapour Bakhtiar.
Two weeks later, on Khomeini's orders, the demonstrators freed five women and eight black men. Non-American hostages were also freed.
Another American hostage was released on July 11, 1980 due to illness.
The remaining 52 were moved around the compound constantly, handcuffed, beaten, tortured and forced to undergo mock executions at gunpoint.
Operation Eagle Claw ends in disaster
Carter took significant steps to sanction Iran in the first few months of the hostage crisis.
He froze Iranian assets, stopped importing oil from Iran and expelled 183 Iranian diplomats from the US.
Fifty thousand Iranian students in America were also told to report to the nearest immigration office and warned they would be deported if they were found to be in violation of the terms of their visas.
But the militants didn't relent, and threatened to burn the embassy and kill the hostages if the US attempted any military action against Iran.
Carter's actions worked in Khomeini's favour as he sought to free Iran from America's control and use his supreme powers to roll out Islamic doctrine.
At 1am on April 25, 1980, the White House revealed it had attempted a military operation to rescue the hostages, known as Operation Eagle Claw.
But the operation had failed: eight US servicemen were dead and several others injured.
The rescuers got nowhere near the embassy — the mission was aborted when three of the eight helicopters suffered various equipment failures.
As they withdrew from the rendezvous point in the desert, one of the helicopters collided with a transport plane, killing crew on both aircraft.
Their bodies were taken to the embassy in Tehran, where they were put on display during a press conference.
Iran arranged for them to be returned to the US the following month.
A post-White House legacy
Carter took full responsibility for the failed rescue attempt.
With the hostages' lives at stake, he couldn't risk another military operation in Iran, and had to walk the slow diplomatic path to secure their freedom.
Stephen Loosley from the United States Studies Centre at Sydney University says news coverage of the crisis was extensive for a time when media didn't run 24/7.
"Both [US news anchors] Ted Koppel and Walter Cronkite would keep a laser-like focus on the hostage crisis," Mr Loosley says.
"They'd keep the number of hostages up on the screen every night, and the number of days that the hostages had been incarcerated.
"Americans never really lost sight of the fact that their people were imprisoned in a very hostile environment in Tehran."
On July 27, 1980, the Shah died in a Cairo military hospital.
The return of his wealth to Iran became a key part of the agreement to free the hostages, known as the Algiers Accords.
The accords were signed on January 19, 1981, the day before Carter was due to leave the White House.
He'd lost the November 1980 election to Republican candidate Ronald Reagan, a former Hollywood actor and governor of California.
The hostages were meant to be released while Carter was still president, but a delay meant they were freed in the first few hours of Reagan's administration on January 20.
"The Iranians refused to give Carter the satisfaction of saying the hostages were released on his watch," Mr Loosley says.
"Ronald Reagan is viewed as the president who secured the release of the hostages, because of the timing."
In the next decade, Reagan would be credited with playing a major role in ending the Cold War, while Carter faded into relative obscurity
Carter described the Iran hostage crisis as "the most difficult period of my life".
The hostages themselves were traumatised by the ordeal and spent more than 30 years fighting for compensation, which was granted in 2015.
Mr Loosley says Americans look more favourably on what Carter did after his time in the White House.
The Carter Center, a not-for-profit set up by Carter and his wife Rosalynn in 1982, worked to improve human rights and health worldwide.
One of its greatest achievements was the near-eradication of Guinea worm disease, caused by a water-borne parasite.
The Carters also built homes with social housing organisation charity Habitat for Humanity.
"He's looked upon with a fair amount of affection and respect," Mr Loosley said.
"Unfortunately his presidency is seen as somewhat of a low point in in the post-war period because of the Iran hostage crisis."