Former president Bill Clinton addresses an audience at Francis Marion University on Saturday in Florence, S.C. (Alex Holt for The Washington Post)

— Halfway through a 40-minute stump speech here, Bill Clinton arrived on the topic of Bernie Sanders’s proposal for single-payer health coverage — and became annoyed.

“Every time we try to have a debate on this, they say: ‘You don’t understand. We’re creating a revolution. You’re getting in the way. You’re part of the establishment,’ ” Clinton drawled, with more than a hint of frustration in his voice. “God forbid we should have an honest discussion on it.”

Then Clinton changed course again.

“That’s not the point I want to make to you,” he said hastily, before refocusing on his principal assignment: delivering a positive message for his wife’s candidacy rather than attacking her opponent.

In his post-White House years, Clinton has become a coveted Democratic surrogate. But when it comes to his wife’s campaigns, something else can happen: He seems to lose it. It was true in this crucial nominating state in 2008, where Hillary Clinton lost badly to Barack Obama. And it’s been true this month, when the former president has reemerged as a potent but unpredictable advocate who sometimes helps his wife’s cause — and sometimes doesn’t.

Former president Bill Clinton got a mixed reception while campaigning for Hillary Clinton in New Hampshire. He was criticized for attacking Bernie Sanders and calling his supporters “sexist.” (Alice Li/The Washington Post)

For a moment here in Florence over the weekend, it seemed that this crowd of more than 650 would get a glimpse of the Bill Clinton who had broken free of the reins earlier in February, in the closing days of the New Hampshire primary race. Then, Clinton accused Sanders of running a dishonest campaign — and the media of coddling him.

The outburst was widely seen as unhelpful to Hillary Clinton. Her campaign aides emphasized that the former president’s role was to positively reinforce her message, not to be an attack dog. But in an unexpectedly close nominating contest, that has proved a difficult task.

“Bill Clinton is an incomparable genius when it comes to politics — except when it comes to his wife,” said former Obama strategist David Axelrod. “It clouds his judgment.”

Axelrod said he understands why the former president behaves the way he does: because he loves his wife and because he believes she is the best candidate in the race.

“He’s proud of what she’s done, and he can’t believe that people don’t see it,” he said. “He can be super-effective for her. Where he’s not effective is where he has these histrionic episodes.”

A day after that outburst in New Hampshire, Sanders’s name scarcely escaped the former president’s lips, but he let it be known that he wished he was free to say more.

“The hotter this election gets, the more I wish I was just a former president and just for a few months not the spouse of the next one,” Clinton said. “I have to be careful what I say.”

Sometimes, it’s the tone and apparent vitriol in Clinton’s voice that seem to hit the wrong note. Sometimes it’s his actual argument, which doesn’t always mesh with what his wife is saying on the same day, somewhere else on the campaign trail.

When Hillary Clinton launched a new broadside against Sanders last week focused on his criticism of President Obama, her pitch, targeted at Obama supporters, attempted to cast herself as more loyal to the president.

Enter Bill Clinton, at an appearance Thursday in Memphis.

The economy is “rigged,” Clinton told the crowd, appropriating one of Sanders’s favorite terms, “because you don’t have a president who’s a changemaker . . . with a Congress who will work with him.”

It sounded like he was agreeing with one of Sanders’s central arguments about income inequality — but blaming the sitting president for it. The comments launched a barrage of tweets and more than a few GOP attacks accusing the Clintons of hypocrisy.

It was a speed bump in a full-throttle week of attacks on Sanders by Hillary Clinton’s allies. And once again, the former president was on the wrong side of the headlines.

Clinton allies mounted a familiar defense, trying to tamp down the significance of what the former president had said.

“What Clinton was clearly trying to say is that the GOP has thwarted President Obama at every turn,” said longtime Clinton ally Paul Begala. “Any fair reading of President Clinton’s comments proves that.”

Even on the friendliest of turf, Bill Clinton can run into trouble. His wife’s campaign considers him an enormous asset here in South Carolina and in other Southern states with upcoming contests, where he is hugely popular among the African Americans and moderate whites who make up a vast majority of the Democratic electorate.

Yet even here, he can do damage. Days before the South Carolina primary eight years ago, Bill Clinton called Obama’s candidacy a “fairy tale.” His words plunged Hillary Clinton’s campaign into a racially charged tailspin, and she went on to lose the state’s primary by nearly 30 points.

The blowback from that experience is one reason the Clinton campaign this year is trying to keep him focused on a positive message.

“I don’t think it’s his job to vet her opponent. It’s the job of the media,” said Iowa-based Democratic political operative Jerry Crawford, a longtime ally of both Clintons. “I think he’s at his best when he’s talking about her, when he’s talking about Hillary.”

Bill Clinton’s power on the trail is hard to dispute — but it’s also hard to measure whether he is succeeding at persuading voters to support his wife. He draws large, energetic crowds and nearly as much media attention as the candidate herself.

A glossy video compilation of Clinton’s endorsement of his wife became a campaign staple at events in the first two states. It featured what has become Clinton’s signature slow, professorial delivery of the case for his wife as the “single greatest changemaker” he has ever known.

Clinton’s popularity is driven in part by older voters who recall him as he once was: an energetic, electrifying young politician. But he has also aged dramatically. His words come more slowly and in a raspy voice. His slim stature and drawn features show the toll of age and a stringent diet.

“He does still have the magic when it comes to interacting with the audience,” said Jim Hodges, a former Democratic governor of South Carolina. But Hodges added, “Like anyone who is over the age of 60, you become less of a force of nature.”

The battle for South Carolina will be fierce among young voters, who showed in Iowa and New Hampshire that they are open to supporting Sanders.

For voters like Joshua Keith, a 28-year-old African American small-business owner in Florence, Hillary Clinton still needs to win his vote.

Asked whether Bill Clinton’s endorsement of his wife will make a difference to him, Keith, a former Obama campaign volunteer, replied, “Not really.”

“The last time he was in office, I was 12, maybe,” Keith said with a shrug. “I don’t think it impacts the younger voters.

“I don’t really think that the Clinton name has the stronghold that it did.”

Karen Tumulty contributed to this report.