WASHINGTON — Former presidential candidate John Edwards and federal prosecutors are arguing over whether funds used to cover up his extramarital affair were campaign contributions or just gifts from his longtime friends.

An indictment of the 2004 Democratic vice presidential nominee appeared near, but some people on both sides were still hoping Tuesday for a last-minute deal for Edwards to plead guilty to a negotiated charge.

So far Edwards has refused to admit to felony charges that would likely cost him his law license, according to people with knowledge of the negotiations who spoke on a condition of anonymity because they are supposed to be private. Edwards has said he hopes that once this case is behind him he can revive his legal career, specializing in helping the victims of poverty he championed on the campaign trail.

But the approach of a federal indictment could heighten his desire to stave off a trial that would give wide exposure to sordid details of his affair, the daughter he initially disavowed as his, the vast sums of money that flowed to keep the affair secret and other unflattering tales from inside his campaign. Public airing of those accounts could further damage a reputation he hopes to revive and could bring more pain to his children, who have already endured public scrutiny of their father’s infidelity and their mother’s recent death.

The prosecutors have decided after a two-year investigation that the hundreds of thousands of dollars that two Edwards donors gave to help keep his mistress in hiding were contributions that should have been reported publicly by his campaign fund because they aided his bid for the 2008 presidential nomination. But Edwards’ lawyers have argued the funds were gifts intended to keep the affair a secret from his wife, Elizabeth, who died of cancer in December.

Campaign finance experts say that if the case goes to trial a jury would be asked to decide whether the payments were to influence the campaign, as opposed or in addition to keeping Elizabeth from learning of the affair, and whether Edwards helped coordinate the money, because there’s no limit on the amount of money a person can spend independently of a candidate’s campaign to influence an election.

“It would come down to a jury weighting the degree to which it was personal verses which it was political,” said Paul Ryan, an attorney with the nonprofit Campaign Legal Center. “Often real life isn’t as cut and dried as the law.”

“He wouldn’t be the first person to cause payment of hush money to keep infidelity quiet and hidden from his own family,” Ryan said. “But I think the casual observer would likely conclude that keeping his campaign viable was at least a motivating factor if not the motivating factor.”

Artur Davis, a former Democratic congressman and assistant U.S. attorney from Alabama, said Tuesday that prosecutors shouldn’t be too confident even if Edwards seems unsympathetic.

“Any assumptions about the certainty of a slam-dunk conviction need look no further than the hung jury in the first Rod Blagojevich trial in Chicago,” he said, referring to the former Illinois governor’s bribery case. “It’s hard to imagine a more shattered figure who had endured more public ridicule than Blagojevich, and yet the jury deadlocked on all but one count. Juries are very focused on facts and not personalities.”

Edwards has been fighting to avoid criminal charges for months and hired former members of the Federal Election Commission and other experts to argue the case shouldn’t be pursued. Edwards lawyer Gregory Craig has called such a prosecution unprecedented and “a matter more appropriately a topic for the Federal Election Commission to consider, not a criminal court.”

Prosecutors have cited a little-noticed 11-year-old FEC advisory against personal cash gifts as giving strength to their case, according to people familiar with plea negotiations between the two sides. They spoke on a condition of anonymity because the talks are supposed to be confidential.

In that case, businessman Philip Harvey asked the FEC whether he could give $10,000 gifts to candidates for federal office solely for their personal use in gratitude for their public service. The FEC responded by advisory opinion June 14, 2000, that the gift would be considered a campaign contribution because it would only be given because the recipient was a federal candidate.

The FEC opinion isn’t binding on federal courts, but the sources said it is one argument prosecutors have used to support their assertion of wrongdoing because they say the payments for Edwards’ mistress wouldn’t have been made if he weren’t a candidate.

Edwards’ legal team contends the Harvey case is significantly different from Edwards’ case, according to a person familiar with the team’s thinking. For one thing, the money didn’t go directly to Edwards and couldn’t be used to free personal funds that he could then use to spend directly on the race. Another difference the person cited is that Harvey had no relationship with the candidates he wanted to give to, but Edwards had long-standing friendships with his mistress’ benefactors before and after the race.

One was Fred Baron, a wealthy Texas trial lawyer who served as finance chairman for Edwards’ campaign and acknowledged before his death in 2008 that he sent money to the candidate’s mistress, Reille Hunter. He said the money helped Hunter and Edwards’ former campaign aide Andrew Young, who at the time was publicly claiming paternity of the child Hunter was carrying, to move across country out of the media glare. After dropping out of the race, Edwards admitted the child was his.

Baron told The Associated Press two months before his death that Edwards had no knowledge of what he did. “I did it as a friend,” he said. But a person familiar with the investigation has said prosecutors have evidence Edwards knew Baron was making the payments.

The other benefactor for Hunter and Young was heiress Rachel “Bunny” Mellon. Young wrote in his book, “The Politician,” that he got checks for hundreds of thousands of dollars from Mellon, who used her decorator as intermediary. Mellon’s attorney said she didn’t know where the money was going but intended it as a personal gift.

Mellon, now 100 years old, and Edwards are still friendly. They had lunch together at her Virginia estate last week.