WASHINGTON (AP) — Jimmy Carter used to be one of President Donald Trump ’s favorite political targets, a catchall foil for feckless Democrats that he could jeer at to make himself look strong and decisive.

But lately, Trump’s sentiments on the 39th president have become more wistful as he faces some of the same challenges the late Carter did.

Those include the war in Iran with no end in sight — and now escalating as the U.S. moves to control the Strait of Hormuz — and inflation, a drag on the economy Trump hasn't tamed despite long insisting that his business background would wipe it out.

The comparison seems to be on Trump’s mind, too. Asked last month why he didn’t dispatch U.S. Special Forces into Iran to forcibly remove its enriched uranium, he responded, “I didn’t feel like being Jimmy Carter.”

That recalled the failed 1980 raid to free U.S. hostages that killed eight American servicemen. Trump also said in March that the unsuccessful mission “cost them the election" against Ronald Reagan in 1980, sounding cognizant of political realities in a way he didn't when using Carter as a punchline.

The shift in tone coincides with Trump's increased focus on his personal legacy and comes as the parallels between the two presidents become harder to ignore.

“I think it is dawning on him — it’s getting through even his thick skull — that he’s kicked over a hornet’s nest and his presidency might be remembered for some of the same things Jimmy Carter’s presidency is,” said Johnathan Adler, author of “His Very Best: Jimmy Carter, A Life.”

Despite some similarities, the two had glaring differences

Asked about Trump's change in tone on Carter and the two facing overlapping challenges, White House spokesperson Olivia Wales said, “Trump will never allow Iran to have a nuclear weapon” and “remains laser-focused on implementing his proven economic agenda to lower costs.”

“The president is a one-of-a-kind leader who will always unapologetically advance America’s interests," Wales said in a statement. "The only legacy he is concerned with is making America greater than ever before.”

Kori Schake, a former member of George W. Bush’s National Security Council, said she doesn't think Trump is reassessing Carter. “He doesn’t stitch facts together and create theories," she said.

Still, Trump's more recent comments are a long way from his 2024 reelection campaign, when he routinely called Joe Biden “the worst” president who made Carter look “brilliant” by comparison. Trump still frequently mentions Carter, who died two years ago at age 100, but usually to incorrectly suggest that he was wary of mail-in ballots.

Other disparities between the two are legion.

Carter was married to his wife, Rosalynn, for 77 years, was deeply religious and pledged to “never knowingly lie to the American people.” Trump is twice divorced, relishes cursing publicly and offers a never-ending onslaught of falsehoods.

As president, Carter placed his family's peanut business in a blind trust. Control of the Trump Organization has transferred to Trump's sons, but the president took in nearly $1.2 billion from his crypto businesses last year while not being shy about turning his presidency into a major source of personal benefit in other ways.

Speaking in 1977, Carter declared, “We are now free of that inordinate fear of communism.” Trump has seized on primary wins by progressive Democrats to constantly stoke new fears about communism.

Carter also won the Nobel Peace Prize in 2002. Trump hasn't, despite declaring himself more deserving than any of the award's past recipients.

The two have inflation and Iran in common

Get our all-good news weekly newsletter
FEEL GOOD FRIDAY

While inflation plagued both presidents, Carter had it much worse, facing a peak inflation rate of 14.7% in April 1980. Consumer prices rose 4.2% this May from a year earlier — a three-year high — and though they fell sharpl y from May to June, that decline included lower gas prices fueled by a U.S.-Iran ceasefire. That deal is now in tatters, driving up oil prices again.

Trump suggested he didn't think about Americans' financial woes when it comes to Iran, a war he started in conjunction with Israel in February. More recently, he shrugged off inflation concerns. But resolution has proved tricky and U.S. attacks have intensified anew after Iran's attacks on commercial ships in the Strait of Hormuz.

Like Trump, Carter was also bedeviled by the strait, declaring during his 1980 State of the Union address that the situation “demands the participation of all those who rely on oil from the Middle East and who are concerned with global peace and stability.”

Another Trump-Carter parallel was the Democrat having considered military action to seize Kharg Island, though he ultimately decided against it so as not to jeopardize the hostages. Trump targeted the island with U.S. strikes early in the war, looking to thwart Iranian oil exports, and has threatened it again.

Schake, a senior fellow and director of foreign and defense policy studies at the American Enterprise Institute, noted a key difference was “while the Carter administration gave serious consideration to attacking Kharg Island, the reason they didn’t do it was they didn’t want to be at war with Iran."

"And we’re already at war with Iran,” she said.

Adler said Iran tried to hurt Carter's reelection chances and raised the possibility that they may do the same to Trump's Republican Party ahead of the November midterm elections.

“These people are master diplomats, and they proved that during the Carter administration," Adler said. "They’re proving that again. They’re really good at rope-a-dope.”

Trump now talks up presidential history

The president has lately name-checked many of his predecessors, praising William McKinley 's support for tariffs and Teddy Roosevelt as a “great he-man.” Trump said a key reason for reaching the now-imperiled June ceasefire with Iran was to avoid the “economic catastrophe " that befell Herbert Hoover.

“I’m a student of a lot of history,” Trump said this week.

During his first term, Trump frequently compared his own populist streak to Andrew Jackson's. He still praises Jackson but has more recently extolled many past presidential records, including those of Democrats like Franklin Delano Roosevelt.

Trump even listed some of Carter's accomplishments on the “ Walk of Fame” he installed along the White House Colonnade despite displays for other Democrats, such as Barack Obama and Biden, offering biting attacks.

“Trump is thinking of his legacy, and he might have thought that attacking Iran would have enhanced it. But, in fact, it will seriously hurt,” James P. Pfiffner, a professor emeritus at George Mason University and author of several books including “The Character Factor: How We Judge Our Presidents,” said via email.

After his presidency, Adler said, Carter asked Trump for a donation to help build Carter's presidential library. Trump later wrote that Carter wanted $5 million, but he didn't answer him.

Then, during Trump's first term, Carter wrote the president a letter and Trump called to thank him, eventually leaving Carter with the impression that he might serve as a special envoy to China — an offer that never actually materialized.

“If he had learned anything from Carter’s experience — and listened to predictions about the Strait of Hormuz — he would have hesitated," Pfiffner said of war with Iran. “But he ignored lessons of history and geography.”