The speechwriter called him a liar. The campaign flack did, too. Even John Edwards’s own defense attorney repeatedly told a packed federal courtroom Wednesday that his client had lied.

The one person, though, who struggled most to come to grips with Edwards’s mendacity was a headstrong woman who could not be there as prosecutors neared the conclusion of their federal election law case against the former presidential candidate: his wife, Elizabeth, who died of cancer in December 2010.

Elizabeth Edwards “did not want to believe” that her husband fathered a child with his mistress, testified Jennifer Palmieri, a close friend of the former senator’s wife who is now deputy communications director in the Obama White House.

In those painful days, as Edwards’s affair with Rielle Hunter was coming to light, Elizabeth Edwards would sometimes allow herself to wonder whether her husband wasn’t lying to her, Palmieri said. Maybe there was an explanation. But Palmieri would cut her off.

“I would always respond, ‘No, no, I think he’s lying to you,’ ” Palmieri testified.

Palmieri, who served for six months as spokeswoman for Edwards’s 2008 presidential campaign and later as an informal adviser, painted her former boss as an ambitious politician who sometimes seemed out of touch with reality. During a heated argument with his wife in an Iowa hotel room, Edwards seemed like “more of a spectator than a participant,” Palmieri testified. “I found it a little unnerving.”

The couple were arguing because Elizabeth Edwards had learned that her husband’s close friend and benefactor, lawyer Fred Baron, and his wife, Lisa Blue, were spending considerable time with Hunter and lavishing money and luxuries on her, including flying her to Los Angeles for a shopping trip. At the time, Palmieri testified, “Elizabeth thought this was all in the past. . . . Elizabeth just wanted Rielle out of their lives entirely. . . . She was really upset about it.”

Even as reporters for several publications were digging up evidence of Edwards’s deceptions, he persisted with the notion that he had a political future, Palmieri said. After promising to endorse then-candidate Barack Obama, Edwards told her he thought he could secure a prestigious speaking role at the Democratic National Convention and be appointed attorney general.

“I told him both of those options were gone,” Palmieri testified. “I thought he was deluded for thinking otherwise.”

The most gripping moments of Palmieri’s testimony came when she described Elizabeth Edwards’s final days. Before she could speak, Palmieri broke into sobs and took several moments to compose herself before she could go on.

Elizabeth Edwards had told Palmieri that she worried “she would be alone when she died,” that “there would not be a man around her who loved her,” the former campaign aide said. And so it was that John Edwards returned to his wife’s side for the last days of her life, even though they had separated. As Palmieri spoke, Edwards — who had stared blankly from his seat at the defense table for much of the testimony — drew a hand over his eyes. His face twisted into a pained expression.

Palmieri’s testimony is critical to the prosecution’s attempt to establish that Edwards was going to great lengths to conceal his affair and that he was aware that Baron, who was a campaign contributor, was spending money to help keep Hunter happy and quiet. The prosecution theory is that Edwards violated campaign finance law by funneling hundreds of thousands of dollars from the heiress Rachel “Bunny” Mellon to Hunter and his former aide, Andrew Young, to cover up the affair.

Young is eager to see his former boss convicted, according to testimony Wednesday by Edwards’s former speechwriter, Wendy Button. When commentators predicted that Edwards would be criminally charged, Young said, “I hope they’re right,” Button affirmed under cross-examination by Edwards’s defense attorney, Abbe Lowell. When commentators predicted Edwards would not be charged, she said, Young would say, “I hope they’re wrong.”

Prosecutors told Judge Catherine Eagles that they expect to wrap up their case Thursday by calling two federal agents to testify. But as they rattled off their list of final witnesses, the name everyone was listening for was missing: Rielle Hunter. Edwards’s mistress has been described as a loose cannon during the case, and her possible appearance as a government witness has been among the most intensely awaited developments in the trial, in its third week in a federal courtroom in Greensboro.

Now the speculation shifts to two other questions: Might she testify for the defense? And, will the father of her child, the man who once thought he could be president of the United States, take the witness stand?